heiwiper / jeu-de-taquin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description

This Project was carried out for educational purpose, it’s main objective is to implement a problem solving algorithm in the game Jeu De Taquin. Two heuristics were chosen in order to find the optimal solution:

Non Similar Boxes
For each cell of the matrix that doesn’t match with the final matrix the cost is incremented by 1, but actually it’s incremented by 2 because a cell doesn’t match it’s final cell implies that another cell doesn’t match too since the game is about swapping cells.
Euclidian Distance
For each cell A we calculate the euclidian distance from that cell to the cell B containing the digit that should be in the final matrix in cell A. When the digit is in the right cell the distance is equal to 0.

Building

Open main.pde as a Processing sketch, install G4P library and run the sketch.

Controls

PLAY mode

These controls are used for swapping the empty cell with other cells.

ButtonAction
UPSwap the empty cell with the upper cell
DOWNSwap the empty cell with the bottom cell
RIGHTSwap the empty cell with the right cell
LEFTSwap the empty cell with the left cell

AUTO 1 and AUTO 2 modes

These controls are used to explore the steps of the solution when it is found.

ButtonAction
RIGHTMove to the next step
LEFTMove to the previous step

EDIT 1 and EDIT 2 modes

ButtonAction
Right mouse buttonSwaps between the two cells which where clicked consecutively

About

License:GNU General Public License v3.0


Languages

Language:Processing 100.0%