Skip to content

kohinoor23/QE-Humbug-Puzzle

Repository files navigation

Humbug - Genius Puzzle Solver

Humbug - Genuis Puzzle, is a logical puzzle game, available as an android/iOS app. Here.


This program can be used to solve the levels 1-90 of the game. Pull requests are welcome for more levels :).

Instructions:

  • Download the Humbug Puzzle app.
  • Clone this repository to your device.
  • On terminal, run this command:

Linux/MacOS

bash run.sh <maxMoves> testcases/level<levelNumber>.txt

Windows

.\run.bat <maxMoves> testcases/level<levelNumber>.txt
  • Follow the steps printed in terminal, and proceed to the next level.

Each level should not take more than 15 seconds to solve. In fact, except two levels, most will be solve under 5 seconds.

Encoding the levels

This section details how the levels of the app have been encoded before being processed by code. Future developers can feel free to extend this.

Consider level 10 :

humbug_level_10

The game state is represented as a matrix. The input will be given as a matrix. The matrix elements can belong to the above classes.

Token Description
. No boundary wall, empty space
X Normal block
Y Target block
W Wall
P Spider
G Grasshopper
S Snail
L LadyBug
B Butterfly
H HoneyBee

If the grid is n*m, then the matrix size is (2n+1)*(2m+1). The tiles of game are present in (odd, odd) indices. Rest are to store walls.

Refer the above image of Level 10. The top left of matrix is the west corner of the image grid in game.

The test case files consist of this grid, and the last line contains the number of moves to solve the level as per the original game.

Sample Encoding:
...........
.....Y...Y.
...........
.G.GWSWPWY.
...........
.......X...
...........
.......Y...
.......W...

Test Case Generation (New)

Install the requirements listed in requirements.txt. Run in terminal

pip install -r requirements.txt

Run in terminal

python test-case-generator.py

Output will be saved to level.txt.

Sample Encoding:

test_gen