ayushicoder18 / soduku-solver

For solving the real-time sudoku from c plus plus language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

soduku-solver

Checked: OK

A simple Sudoku generator and solver This is a Sudoku game written in python (less than 100 lines of code).

A puzzle can be generated by following function with a mask rate.

generate_sudoku(mask_rate=0.7)

[[1 0 0 5 0 0 0 0 3]
 [0 3 7 0 0 1 0 0 4]
 [0 0 0 0 0 2 0 0 0]
 [0 0 0 0 9 4 0 0 0]
 [0 0 4 0 0 0 0 3 2]
 [0 0 0 3 2 5 0 0 0]
 [0 0 0 0 0 0 2 0 0]
 [7 4 0 0 0 0 0 0 0]
 [8 0 0 0 0 3 1 0 0]]

By using solver() function, it tries to solve the puzzle.

solved = solve(puzzle)

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

If you have your own solution, you can validate it by following function:

check_solution(your_puzzle)

About

For solving the real-time sudoku from c plus plus language

License:MIT License


Languages

Language:Python 31.8%Language:Go 30.3%Language:JavaScript 20.9%Language:C++ 15.3%Language:PHP 1.7%