Suguru Solver is a portable application written in TypeScript and Electron. It allows users to generate, edit, and solve Suguru puzzles. Users can interact with the grid by clicking on the boundaries to add or remove borders and by clicking on the cells to set the initial numbers of the puzzle. It can also log the steps to help you debug the algorithm.
The solver uses a group based algorithm to handle Suguru puzzles. The algorithm follows these key steps:
-
Group Assignment: Each cell in the grid is assigned to a group based on the connected cells within its boundary. A unique group ID is given to each connected region.
-
Value Elimination: For each empty cell, the solver checks nearby cells and its own group and eliminates possible values based on the numbers already present in the group or adjacent cells.
-
Single Value Detection: If a cell has only one possible value remaining, that value is assigned to the cell. If no single value exists, a backup strategy is used to select a random empty cell and value and continue the process.
-
Backup and Retry: If the solver encounters an unsolvable state, it loads the previous backup and attempts a different value assignment. This process repeats until the puzzle is fully solved.
-
Termination: The algorithm terminates successfully when all cells have been filled with valid values without conflicts in the groups or adjacent cells and displays them to the screen.
The algorithm efficiently solves the puzzle by iteratively refining possible values and backing up the state when necessary.
To run this project locally, follow these steps:
- Node.js
- TypeScript
- Electron
-
Clone the repository:
git clone https://github.com/Wyntine/SolverApp.git cd SolverApp -
Install dependencies:
npm install
To build and run the project, use the following commands:
-
Start the Application:
npm start
-
Build for Production:
npm run build
This will create an executable version of the Suguru Solver for the operating system that you are using.
