This project implements an interactive math puzzle, played as follows (description from here):
The rules are simple: Given a grid of
N x Nsquares, your task is to visit every square exactly once. In each step, you may
- skip 2 squares horizontally or vertically or
- skip 1 square diagonally
- Interactive mode, where the user chooses their path through the grid.
- Automated mode: will generate a solution by employing a depth-first search with Warnsdorff's rule as a heuristic.
- cmake >=3.9.2
- OpenGL 3.3 core
- GLFW3
Clone the repository:
$ git clone --recurse-submodules [url]
Create a build directory,
$ mkdir build && cd build
Build the source with optimizations:
$ cmake -DCMAKE_BUILD_TYPE=RELEASE ..
$ make -j hopscotch
Run the executable from the repository root directory:
$ /home/.../hopscotch/build/src/hopscotch
Legal moves will be highlighted in green. To quit the game, press ESC or Q. To
reset the board, press R.
By default, the game will start in the upper left corner, with a board size of 5 x 5,
with a window resolution of 600 x 600.
The game mode can be changed by supplying command line arguments:
-rand-cset the starting row and column, indexed with 0.-nsets the size of the board.-wsets the width of the window in pixels.-aautomatically solves the game.-isets the number of iterations to attempt in the autosolver.
For example,
$ ./build/src/hopscotch -n 8 -r 1 -w 900
will start the game with an 8 x 8 grid, starting in row 1, in a window of 900 x 900
pixels.
See Building. Instead of building with optimizations, call cmake as
$ cmake -DCMAKE_BUILD_TYPE=DEBUG ..
$ make -j unit_tests
This will create the unit_tests executable in your build directory:
./build/tests/unit_tests
