/Sudoku-with-CSP-paradigm

The provided Python code utilizes the Constraint Satisfaction Problem (CSP) approach to solve a Sudoku puzzle, employing backtracking and constraint propagation to iteratively fill in the grid's empty cells based on the rules of Sudoku.

Primary LanguagePython

Sudoku-with-CSP-paradigm

The provided Python code utilizes the Constraint Satisfaction Problem (CSP) approach to solve a Sudoku puzzle, employing backtracking and constraint propagation to iteratively fill in the grid's empty cells based on the rules of Sudoku.

Initialization:

The code initializes a 9x9 Sudoku grid with given values and a graphical user interface using the Pygame library.

Grid Drawing:

The Pygame window displays the initial state of the Sudoku grid, showing the unsolved puzzle.

CSP Solving:

The Constraint Satisfaction Problem (CSP) solver is implemented to find a solution for the Sudoku puzzle.

Backtracking:

The solver uses a backtracking approach to explore possible values for empty cells, checking the validity of each move.

Constraint Propagation:

The code employs constraint propagation by updating and displaying the grid during solving, showing the intermediate steps.

Final State Display:

Once the CSP solver completes, the Pygame window displays the final solved state of the Sudoku grid.

User Interaction:

The program waits for the user to close the Pygame window, ending the execution.

Capture

Capture 2

This code demonstrates how CSP can be applied to solve a Sudoku puzzle through iterative backtracking and constraint propagation techniques.