Skip to main content

A python library for solving sudoku puzzles using artificial neural networks

Project description

ai-Sudoku-Solver

Solving Sudoku Puzzles using Artificial Neural Networks

Downloads Downloads Downloads


Table of Contents


Installation

pip install ai-sudoku-solver

Usage

Instantiate a SudokuSolver object

from ai_sudoku_solver import SudokuSolver

solver = SudokuSolver("Ritvik19/sudoku-net-v1")

Call the model on your puzzles

puzzle = np.array([[
    [0, 0, 4, 3, 0, 0, 2, 0, 9],
    [0, 0, 5, 0, 0, 9, 0, 0, 1],
    [0, 7, 0, 0, 6, 0, 0, 4, 3],
    [0, 0, 6, 0, 0, 2, 0, 8, 7],
    [1, 9, 0, 0, 0, 7, 4, 0, 0],
    [0, 5, 0, 0, 8, 3, 0, 0, 0],
    [6, 0, 0, 0, 0, 0, 1, 0, 5],
    [0, 0, 3, 5, 0, 8, 6, 9, 0],
    [0, 4, 2, 9, 1, 0, 3, 0, 0]
]])
solution = solver(puzzle)
# array([[
#     [8, 6, 4, 3, 7, 1, 2, 5, 9],
#     [3, 2, 5, 8, 4, 9, 7, 6, 1],
#     [9, 7, 1, 2, 6, 5, 8, 4, 3],
#     [4, 3, 6, 1, 9, 2, 5, 8, 7],
#     [1, 9, 8, 6, 5, 7, 4, 3, 2],
#     [2, 5, 7, 4, 8, 3, 9, 1, 6],
#     [6, 8, 9, 7, 3, 4, 1, 2, 5],
#     [7, 1, 3, 5, 2, 8, 6, 9, 4],
#     [5, 4, 2, 9, 1, 6, 3, 7, 8]
# ]])

Model Gallery

model # parameters trained on accuracy
sudoku-net-v1 3,784,729 1M puzzles 98.138
sudoku-net-v2 3,784,729 10M puzzles 98.212

References

  1. 1 million Sudoku games
  2. 9 Million Sudoku Puzzles and Solutions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai-Sudoku-Solver-1.0.7.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

ai_Sudoku_Solver-1.0.7-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page