Skip to content

Sit back, relax, and let your Sudoku puzzles be solved using brute-force.

License

Notifications You must be signed in to change notification settings

ImSeanConroy/sudoku-cracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sudoku Cracker

Sit back, relax, and let your Sudoku puzzles be solved using brute-force. This simple Python CLI tool allows you to input puzzles directly or provide a file path for automatic solving.

Project Image

Table of Contents

Getting Started

Prerequisites

Before getting started, ensure you have the following installed:

Installation

The following contains instruction for getting this application running locally:

  1. Clone the repository.
git clone https://github.com/ImSeanConroy/sudoku-cracker.git
cd sudoku-cracker
  1. Create and start virtual environment
python3 -m venv env
source env/bin/activate
  1. Install dependencies
pip3 install -r requirements.txt
  1. Run script
python main.py --cubes cube1 cube2 cube3 cube4 cube5 cube6 cube7 cube8 cube9

Usage

The Sudoku Cracker allows you to input your Sudoku puzzle as 9 groups of 3x3 numbers. Each group represents a 3x3 cube, and the numbers are separated by commas. Use 0 for empty cells.

Example Input

Solve puzzle from a set of cubes (input directly):

python main.py --cubes 003500160 029700005 100000009 049000050 000006010 000250006 000008000 050037000 080002001

Additional Options

Solve puzzle from a text file where each line represents a row of the puzzle and each number is seperated by a space:

python main.py --file "examples/example.txt"

Example file format (example.txt):

0 0 3 0 2 9 1 0 0 
5 0 0 7 0 0 0 0 0 
1 6 0 0 0 5 0 0 9 
0 4 9 0 0 0 0 0 0 
0 0 0 0 0 6 2 5 0 
0 5 0 0 1 0 0 0 6 
0 0 0 0 5 0 0 8 0 
0 0 8 0 3 7 0 0 2 
0 0 0 0 0 0 0 0 1

Solve puzzle from a image. Ensure that the image contains only the Sudoku puzzle and is centered and extends as close to the image’s edges as possible for optimal recognition (example.png):

python main.py --image "examples/example.png"

Solve puzzle from a set of rows (input directly):

python main.py --rows "..."

Disable Color Output:

python main.py --cubes "..." --no-color

Disable Runtime Display:

python main.py --cubes "..." --no-runtime

Disable Column and Row Seperators:

python main.py --cubes "..." --no-seperators

Development and Testing

  1. Run the following command to run the full test suit:
pytest tests/

License

This project is Distributed under the MIT License - see the LICENSE file for information.

Support

If you are having problems, please let me know by raising a new issue.

About

Sit back, relax, and let your Sudoku puzzles be solved using brute-force.

Topics

Resources

License

Stars

Watchers

Forks

Languages