Skip to content

Martan03/futoshiki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

futoshiki

My bachelor thesis: How to Solve Futoshiki by Means of Automata.

Table of Contents

Running the project

App was tested on Linux only, other operating systems might not work.

To build the project, you need to have the Rust Toolchain installed (see rust installation page). When you have the Rust Toochain, you can build the project with cargo:

cargo build -r

If you have issues with permissions for cargo registry cache, you can build the project like this (this is how you have to build on merlin):

CARGO_HOME=target/cargo-home/ cargo build -r

After it's done compiling, the binary will be target/release/futoshiki. Because the project is a console program, it needs to be run from terminal.

Running on merlin server

The binary in the archive (futoshiki) can be used on merlin. To create a new build on merlin, you need to run the project like this:

CARGO_HOME=target/cargo-home cargo build -r

Usage

In all the examples, the path to the project binary is substituted by futoshiki. If you want run the project, you need to use the path to the built binary from the previous step.

You can start futoshiki in default size (4×4) by running:

futoshiki

To play a game with different size and different solving algorithm, you can do it like this:

futoshiki -s 10 --solver bt

All the other usage and options can be seen in the help:

./futoshiki -h

Detailed description

What is Futoshiki?

It's a board-based puzzle game which is quite similar to Sudoku. It is also known as Unequal. It's played on the square board of any size (4×4 is common). The goal is to fill the board with missing numbers so each row and column contains every number from 1 to board size exactly once, plus all the inequalities must be satisfied.

Game

Game is implemented using TUI. When you start a game, you get put into board solver screen. On this screen you can solve board, generate new one or let an algorithm to solve the board for you. To change selected cells you can use Arrow keys, place number by typing the desired digit.

You can also switch to board creation screen (by pressing b key), where you can create your own board. You can add digits the same way as in board solver screen, but you can also add conditions. To add condition, you have to press corresponding condition (< or >) and Arrow in which direction the condition should be placed.

All other keybinds are listed in the help on the bottom of each page.

Benchmark

Running

When running the program with bench argument:

./futoshiki bench --solver ac3 --solver fc -s 4 -s 5 -r 10 -b 5

you start a benchmark of given algorithms. Algorithms can be given using the --solver flag followed by any solver type (all solver types are displayed in help). If no solver is provided, all algorithms are used.

You have to also provide board sizes (-s flag) which should be tested. Example above benchmarks boards with sizes 4 and 5.

You can also set how many times board will be tested to eliminate any fluctuations (-r flag) and number of boards that should be tested for each size (-b flag). Default value for board repeats is 10 and number of boards is 1.

Result

Results are printed to the console ordered by the board size. Each board size is also printed with all the tested algorithms ordered by their average speed and each algorithm is printed with its best, average and the worst time.

Benchmark also generates a graf (benchmark.png), which contains plotted average times for each algorithm and board size.

Config

You can also set default values in the config file, which is saved in the config directory (on linux it should be ~/.config/futoshiki/config.json). You can set a default size, solver or theme with which the app will be started without having to use command line arguments.

You can edit the config by running:

./futoshiki config

which opens the config.json file in default editor. The config file is created only when running the command above and config file doesn't exist already.

Config file is not created in any other case! You can either create it manually or use the command above.

Links

About

Futoshiki TUI implementation in Rust 🦀

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published