Giter Club home page Giter Club logo

sudoku-solver's Introduction

A general solver for Constraint Satisfaction Problems

A solver for 9x9 sudoku puzzles using backtracking search and the arc-consistency algorithm AC-3.

This code is written as an assignment for the course TDT4136 - Introduction to Artificial Intelligence ๐Ÿซ

How to run

git clone https://github.com/dilawarm/sudoku-solver.git
cd sudoku-solver

Make your own puzzle

Add your own 9x9 sudoku puzzle here. Here is the AI Escargot puzzle:

$ cat puzzles/ai_escargot.txt
100007090
030020008
009600500
005300900
010080002
600004000
300000010
040000007
007000300

Solve the puzzle

python3 sudoku.py
Filename: ai_escargot.txt
Solution for ai_escargot.txt:
1 6 2 | 8 5 7 | 4 9 3 
5 3 4 | 1 2 9 | 6 7 8 
7 8 9 | 6 4 3 | 5 2 1 
------+-------+------
4 7 5 | 3 1 2 | 9 8 6 
9 1 3 | 5 8 6 | 7 4 2 
6 2 8 | 7 9 4 | 1 3 5 
------+-------+------
3 5 6 | 4 7 8 | 2 1 9 
2 4 1 | 9 3 5 | 8 6 7 
8 9 7 | 2 6 1 | 3 5 4 

Enjoy! ๐Ÿš€

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.