Coder Social home page Coder Social logo

sudoku-solver's Introduction

sudoku-solver

๐Ÿ‘จโ€๐Ÿ’ป About it

The solver in Python language uses the PySAT toolkit to solve the sudoku using formulas in the Conjunctive Normal Form (CNF) of Boolean Logic.

โš™ How it works

The sudoku is divided into nine large quadrants referenced with rows and columns from 1 to 3. Each quadrant contains nine small squares, identified by rows and columns numbered from 1 to 3.

The program takes as input a file with strings in the format "sudoku_i_j_p_q_N", where:

  • N is the value (from 1 to 9) that will fill the small square;
  • i is the row value of the position of N on the quadrant;
  • j is the column value of the position of N on the quadrant;
  • p is the row value of the quadrant;
  • q is the column value of the quadrant.

The following example shows the input for the "world's most difficult Sudoku" designed by Arto Inkala.

sudoku_1_3_1_1_5
sudoku_2_1_1_1_8
sudoku_3_2_1_1_7
sudoku_1_1_1_2_3
sudoku_3_2_1_2_1
sudoku_2_2_1_3_2
sudoku_3_1_1_3_5
sudoku_1_1_2_1_4
sudoku_2_2_2_1_1
sudoku_3_3_2_1_3
sudoku_1_3_2_2_5
sudoku_2_2_2_2_7
sudoku_3_1_2_2_2
sudoku_1_1_2_3_3
sudoku_2_3_2_3_6
sudoku_3_2_2_3_8
sudoku_1_2_3_1_6
sudoku_2_3_3_1_4
sudoku_1_1_3_2_5
sudoku_3_3_3_2_9
sudoku_1_3_3_3_9
sudoku_2_2_3_3_3
sudoku_3_1_3_3_7

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

sudoku-solver's People

Contributors

adrianwilker avatar

Watchers

 avatar

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.