Skip to content

Instantly share code, notes, and snippets.

View diogohmcruz's full-sized avatar
🏠
Working from home

Diogo Cruz diogohmcruz

🏠
Working from home
View GitHub Profile
@diogohmcruz
diogohmcruz / sudokuSolver.pl
Last active December 14, 2025 14:47
Sudoku Solver
/**
* Sudoku solver using Constraint Logic Programming over Finite Domains (CLP(FD)).
*
* This program defines a `sudoku/1` predicate that solves a Sudoku puzzle.
* The input is a list of lists representing the Sudoku rows, where `_` represents empty cells.
* The program uses constraints to ensure that each number from 1 to 9 appears exactly once in each of the classic
* sudoku constraints: row, column, and 3x3 block.
*
* Requirements:
* - SWI-Prolog with the CLP(FD) library installed.