adammain / ai-agent-sudoku

AI program solves Diagonal Sudokus using constraint propagation and search techniques. Additionally, taught the agent to use the Naked Twins advanced Sudoku strategy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sudoku Solver

Screenshot

alt text

Install

This project requires Python 3. Clone this repository

git clone https://github.com/adammain/ai-agent-sudoku

How to run

python3 sudoku.py

Input Format

81 characters long string row wise 9x9 with each character implying the value filled in that particular box. If box is unfilled put '.' as its place. For example: alt text For this sudoku input:

4.....8.5.3..........7......2.....6.....8.4......1.......6.3.7.5..2.....1.4......

Used in functions elimination and naked_twin in utils.py to eliminate the possibility of presence of any digit if it is present in corresponding row, column or square.

Implemented recursion techniques to create depth-first-search trees for solving hard sudokus that need guess work in any particular box to proceed.

  • Only choice rule
  • Single possibility rule
  • Naked Twin exclusion rule

MIT License

Copyright (c) 2017 Adam Main

About

AI program solves Diagonal Sudokus using constraint propagation and search techniques. Additionally, taught the agent to use the Naked Twins advanced Sudoku strategy.

License:MIT License


Languages

Language:Python 100.0%