2pa4ul2 / Killer-Sudoku

Killer Sudoku Program Using Simulated Annealing, Backtracking, and Backjumping Algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Killer Sudoku Solver

Description

This Python program provides a solver for Killer Sudoku puzzles. Killer Sudoku is a variant of Sudoku that includes cages, where groups of cells must sum up to specific values, adding an additional layer of complexity to the puzzle.

Features

  • Solve Killer Sudoku puzzles with ease.
  • Choose between three solving algorithms: Backtracking, Backjumping, and Simulated annealing .
  • Input cage configurations directly into the program.
  • Get detailed information about the solved puzzle, including the placement of numbers and cage configurations.

Table of Contents

Installation

  1. Clone the repository:

    git clone https://github.com/2pa4ul2/Killer-Sudoku.git
  2. Navigate to the project directory

    cd Killer-Sudoku

Usage

Input Cage Configurations

  • Provide the cage configurations in the specified format (sum,cell1,cell2,...), separated by semicolons. For example:

    Enter cages (sum,cell1,cell2,...) separated by semicolon: 7,00,10;6,11,20,21;5,01,02;3,03,13;5,12,22;6,30,31;8,23,32,33

Run the Program

  • Execute the Python script to solve the puzzle:

    • Backjumping
    python sudokubackjump.py
    • Backtracking
    python sudokubacktrack.py
    • Simulated Annealing
    python SimAnnealling.py

Examples

Sample input for the program:

7,00,10;6,11,20,21;5,01,02;3,03,13;5,12,22;6,30,31;8,23,32,33

Output

Solution found:
2  4  1  3
1  3  2  4
4  1  3  2
3  2  4  1
Cages:
Sum: 7, Cells: [(0, 0), (1, 0)]
Sum: 6, Cells: [(1, 1), (2, 0), (2, 1)]
Sum: 5, Cells: [(0, 1), (0, 2)]
Sum: 3, Cells: [(0, 3), (1, 3)]
Sum: 5, Cells: [(1, 2), (2, 2)]
Sum: 6, Cells: [(3, 0), (3, 1)]
Sum: 8, Cells: [(2, 3), (3, 2), (3, 3)]

Dependencies

  • Python 3.x

About

Killer Sudoku Program Using Simulated Annealing, Backtracking, and Backjumping Algorithm

License:MIT License


Languages

Language:Python 100.0%