Skip to content

0xOsiris/TwiddleSolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

___________       .__    .___  .___.__          
\__    ___/_  _  _|__| __| _/__| _/|  |   ____  
  |    |  \ \/ \/ /  |/ __ |/ __ | |  | _/ __ \ 
  |    |   \     /|  / /_/ / /_/ | |  |_\  ___/ 
  |____|    \/\_/ |__\____ \____ | |____/\___  >
                          \/    \/           \/ 

Breadth First search solution to solve 3x3 twiddle board implemented in Java. A link to a demo of the game Twiddle can be found below.

https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/twiddle.html

Puzzle Description

Twiddle is a simple puzzle game with an nxn grid of sequentially numbered tiles. This repository implements a Java BFS algorithm to solve an arbitrary 3x3 twiddle board in the optimal number of moves.

With a 3x3 board, the initial values in the 9 tiles are randomly initialized to a unique value in 1..9. A 3x3 board has 4 possible axis of rotation, and a Clockwise/Counter Clockwise rotation on each of the 4 axis is a legal move. The goal is to order all the tiles in ascending order through a sequence of Clockwise/Counter Clockwise rotation on the 4 axis' of the board.

twiddle-web

Solver

Performs a BFS traversal of a tree generated by applying all possible moves to the initial state, and cutting out repeated states from the queue. Applying all possible moves to each sequential state until it reaches the goal state of the board. It then traverses back up the path to the initial state, and outputs all of the moves leading to the goal state as the solution.

Twiddle

Main function, this is will prompt you to enter an initial board state to be solved represented as a 9 digiit string.

Node

Defines all of the logic on C/CC moves and their respective transformation logic on the board state.

About

Breadth First search solution to solve 3x3 twiddle board in short time

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages