Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Forrest-T committed Apr 8, 2021
1 parent 41cf830 commit 1d922d7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Unruly-game-solver

One of my good friends introduced me to a puzzle-solving app for Android called simply _Puzzles_. This is my attempt to create a time-efficient solver for one of the games _Unruly_, without resorting to brute-force.
One of my good friends introduced me to a puzzle-solving app for Android called simply _Puzzles_. This is my attempt to create a time-efficient solver for one of the games _Unruly_, without resorting to brute-force. It's also a good chance to play around with some C++17 features like std::optional :)

## Brief overview of the game:
* You are given a square board with an even number of rows/columns
Expand All @@ -10,9 +10,9 @@ One of my good friends introduced me to a puzzle-solving app for Android called
* Every row and column must have the same number of black and white tiles

## Strategy
Two methods are implemented: inferDirectly() and infer1()
* inferDirectly() uses the idea that every square must be either black, or white. If only one color leads to an invalid game configuration, that color can be inferred.
* infer1() uses the idea that every row must contain half as many tiles of each color as the side length. If a row or column needs one more tile of a given color, each configuration will be tried. If this leads to an invalid configuration, the other color can be inferred.
Two methods are implemented: directInference() and speculativeInference()
* directInference() uses the idea that every square must be either black, or white. If a move is illegal, the move of the opposite color can be inferred.
* speculativeInference() tries valid moves speculatively, and then plays out the game using direct inference. If a move leads to the game being unwinnable or in an invalid state, the move of the opposite color can be inferred.

## Notes
Originally, it was planned to extend infer1() to an arbitrary depth and number of remaining tiles. However, just these two methods are able to solve test games of size 14 completely. Termination is guaranteed, but there may exist some configurations which cannot be resolved to a solution.
Originally, it was planned to extend speculativeInference recursively, but the solver in its current state is already able to solve test games of size 14, the max generated by my puzzle app. Termination is guaranteed, but there may exist some configurations which cannot be resolved to a solution.

0 comments on commit 1d922d7

Please sign in to comment.