An open API service indexing awesome lists of open source software.

https://github.com/nicoxeye/genetic-algorithm-sudoku

Metaheuristic Problem In Sudoku
https://github.com/nicoxeye/genetic-algorithm-sudoku

c metaheuristic-algorithms metaheuristics sudoku sudoku-generator sudoku-solver

Last synced: 3 months ago
JSON representation

Metaheuristic Problem In Sudoku

Awesome Lists containing this project

README

          

# Genetic-Algorithm-Sudoku
sudoku for the 3rd time, god help me <3

---


MAIN STEPS
1. For each generation:
- Generate offspring from selected parents
- Apply crossover and mutation
- Evaluate fitness
- Track best individual so far
- Exit early if perfect solution is found
2. After loop: Print best solution overall

---
### FITNESS EXPLANATION

- each row, column, and box can contribute up to 9 unique digits
- there are 9 rows + 9 columns + 9 boxes = 27 groups
- maximum fitness = 27 × 9 = 243

which means a fully valid Sudoku with no repeats anywhere

## EXAMPLES WHEN RUNNING THE PROGRAM

![image](https://github.com/user-attachments/assets/d1ea81ac-1059-408e-9794-7078673842b3)

### BUILDING THE APP:
```
gcc main.c sudoku.c ga.c util.c -o ga_solvedsudoku
```
run either the .exe app in the folder or by cmd

![image](https://github.com/user-attachments/assets/8327e11b-b4c0-46f0-a2f7-715659e8fe00)