/futoshiki-solver

A python solver of futoshikis from an image

Primary LanguageJupyter Notebook

'||''''|            ||                 '||          '||              .|'''|         '||`                      
 ||  .              ||                  ||      ''   ||       ''     ||              ||                       
 ||''|   '||  ||` ''||''  .|''|, (''''  ||''|,  ||   || //`   ||     `|'''|, .|''|,  ||  \\  // .|''|, '||''| 
 ||       ||  ||    ||    ||  ||  `'')  ||  ||  ||   ||<<     ||      .   || ||  ||  ||   \\//  ||..||  ||    
.||.      `|..'|.   `|..' `|..|' `...' .||  || .||. .|| \\.  .||.     |...|' `|..|' .||.   \/   `|...  .||.   

An OR-TOOLS based solver of Futoshiki (不等式) puzzles from images

Example

Input Puzzle

Solution

In Real Time

Requirements

pip install -r requirements.txt

The latest version of tesseract-ocr is also required. This can easily be installed with:

sudo apt install tesseract-ocr

Depending on your OS and version of tesseract, you may also have to download the eng.traineddata file from here. It should be placed in /usr/local/share/tessdataand the environment variable TESSDATA_PREFIX should be set to equal this path:

On Unix - export TESSDATA_PREFIX=/usr/local/share/tessdata

Running

cd main/
python main.py

Press SPACE to run the initial capture - after this the capture window will close, but images will continue to be captured from the semantic segmentation model predictions until a solution(s) for the puzzle is found

Write ups

Medium - Solving Futoshiki Puzzles in Python Medium - Building a Custom Semantic Segmentation Model