GithubHelp home page GithubHelp logo

calculator-the-game-solver's Introduction

Puzzle Solver for Calculator: The Game

This project provides a puzzle solver (solution finder) for the game Calculator: The Game and Calculator 2: The Game.

It uses a backtracking algorithm to try to find one possible solution (might not be the simplest) for the given puzzle.

The algorithm is written in Python v3.7+.

Command Line Usage

$ ./calculator_solver.py -h
usage: calculator_solver.py [-h] -g GOAL [GOAL ...] -m MOVES [-t TOTAL] -b
                            BUTTON [BUTTON ...] [-p LEFT RIGHT]

Calculator: The Game - Puzzle Solver

optional arguments:
  -h, --help            show this help message and exit
  -g GOAL [GOAL ...], --goals GOAL [GOAL ...]
                        the goal number(s) or password(s)
  -m MOVES, --moves MOVES
                        the number of moves can make
  -t TOTAL, --total TOTAL
                        the initial total number
  -b BUTTON [BUTTON ...], --buttons BUTTON [BUTTON ...]
                        the buttons
  -p LEFT RIGHT, --portals LEFT RIGHT
                        portal range (zero based)

For more details, check doc.

Example

v1 Level 199

v1 Level 199

$ ./calculator_solver.py -m 6 -g 3507 -t 3002 -b '3=>5' '>' 7 inv10 -p 4 0
goal: 3507
350 7 -> 3507
750 Inv10 -> 350
507 Shift> -> 750
50 7 -> 507
30 3=>5 -> 50
3002 7 -> 30

So the solution move sequence is: 7, 3=>5, 7, Shift>, Inv10, 7.

v2 Level 184

v2 Level 184

$ ./calculator_solver.py -m 3 -g 49 11 -t 54 -b /5 '>' lock
goal: 49
45 /5 -> 49
45 LOCK{'pos': 1} -> 45
54 Shift> -> 45

goal: 11
55 /5 -> 11
54 Shift> -> 55
54 LOCK{'pos': 1} -> 54

The solution move sequence for goal 49 is: Shift>, LOCK (press < once), /5; for goal 11 is: LOCK (press < once), Shift>, /5.

calculator-the-game-solver's People

Contributors

calfzhou avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.