Git Product home page Git Product logo

sudoku's Introduction

Sudoku

Sudoku solver using backtracking algorithm in Python

Sudoku is very common mathematical problem. Algorithm - Backtracking

The approach is try to find valid solution for sudoku. Steps - 1) Pick empty square 2) Try all numbers and find the correct one that works 3) Repeat for all squares 4) If number is wrong, backtrack (There is no possible square for that value)

Important Functions-

isvalid => Check each column just like each element in row and is it equal to whatever the number is that we just added in . When we are checking through board if it's position we just inserted we ignore that position but if it's any other position that's gonna matter because that means there are two of same numbers in that row.

backtracking => We are gonna loop through values 1 to 9 and check if by adding those into board it would be a valid solution. If it's valid then add it on board and recursively try to finish the solution by calling backtracking on our new screen. If it's false then backtrack and find correct one.

Important keys-

Space -> Solve the sudoku for user 1-9 -> To type number in empty box Enter -> Value is written in box if it's right and if wrong then red cross in left-bottom of screen

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.