A simple python solver for linux gnome game five-or-more. Including bash scripts helping to get the game state from screen.
Go to file
Yuncong Zhang e6e32cec44 Temp store 2017-08-29 13:42:29 +08:00
.gitignore Start implementing GUI 2017-07-23 19:52:54 +08:00
Makefile Update 2015-12-29 20:33:46 +08:00
README.md Modify README.md 2017-06-09 10:40:51 +08:00
addrand.py Basic functionalities 2017-07-23 20:41:06 +08:00
board Restructure utilities 2017-07-23 20:02:18 +08:00
cancel.py Basic functionalities 2017-07-23 20:41:06 +08:00
currmax.py Update 2015-12-27 23:38:40 +08:00
data Temp store 2017-08-29 13:42:29 +08:00
disturb.py Update 2015-12-30 00:07:40 +08:00
fomanl.cpp Temp store 2017-08-29 13:42:29 +08:00
fomanl.py Temp store 2017-08-29 13:42:29 +08:00
generate.sh Use neural network to train solver 2017-08-25 13:37:54 +08:00
getpix.sh Modify README.md 2017-06-09 10:40:51 +08:00
layer1.b.npy Temp store 2017-08-29 13:42:29 +08:00
layer1.w.npy Temp store 2017-08-29 13:42:29 +08:00
layer2.b.npy Temp store 2017-08-29 13:42:29 +08:00
layer2.w.npy Temp store 2017-08-29 13:42:29 +08:00
layer3.b.npy Temp store 2017-08-29 13:42:29 +08:00
layer3.w.npy Temp store 2017-08-29 13:42:29 +08:00
layer4.b.npy Temp store 2017-08-29 13:42:29 +08:00
layer4.w.npy Temp store 2017-08-29 13:42:29 +08:00
learn.sh Update 2015-12-30 20:05:47 +08:00
mid.py Enable learning 2015-12-27 22:40:18 +08:00
nn.py Temp store 2017-08-29 13:42:29 +08:00
param Update 2015-12-30 20:05:47 +08:00
play.py Temp store 2017-08-29 13:42:29 +08:00
run.sh Enable learning 2015-12-27 22:40:18 +08:00
screen.sh Initialize 2015-12-25 23:21:18 +08:00
small_test Temp store 2017-08-29 13:42:29 +08:00
sortout.py Temp store 2017-08-29 13:42:29 +08:00
test_data Temp store 2017-08-29 13:42:29 +08:00
train_data Temp store 2017-08-29 13:42:29 +08:00
util.cpp Use neural network to train solver 2017-08-25 13:37:54 +08:00
util.h Use neural network to train solver 2017-08-25 13:37:54 +08:00
util.py Temp store 2017-08-29 13:42:29 +08:00

README.md

Python-Five-or-more-solver

A simple python solver for linux gnome game five-or-more. Including bash scripts helping to get the game state from screen.

The core solver algorithm is written in C++, and other operations are handled by python and bash scripts.

The screen helper in bash that gets game state from screen usable is heavily relied on the specifics of the five-or-more game. This version specifically targets the ubuntu gnome version, with the appearance setting of style being balls.

To make it usable on your system, you probably have to modify the getpix.sh file. Set prd to be the grid size, offx and offy to be the offset from the up-left corner of the grid where the pixel color is standard. If the color scheme of your version of game is different, you probably have to modify the subsequent color values.

This solver is stateless, i.e. it does not store the history, just analyzes the current board and tells you how to move.

In each step, execute in the commandline ./run. The script will do the following things:

  1. Take a screenshot, save the picture in /tmp directory.
  2. Search for the background color (if yours is different, change it in the script), locate the up-left corner (x0,y0) of the entire board.
  3. For the 8x8 grid of pixels (x0+i*prd+offx,y0+j*prd+offy) for i=0,...,7 and j=0,...,7, obtain the colors and figure out the ball color. After this step, the board state is determined.
  4. Pass the board state to the core solver, then print the solution.
  5. The solution is printed in the following format: an empty grid is a dot (.), a ball is represented by a letter corresponding to its color. If the solution moves one ball to another position, the original position is a dot (.) with blue background color, and the new position is the ball color letter with red foreground color.

If you are not using bash, the print result may be a lot of garbage. You'd better modify the output format according to the color scheme of the shell you use.