Skip to content

Solver of the tents puzzle in Prolog reducing the problem to SAT

Notifications You must be signed in to change notification settings

lauragalera/Tents-Puzzle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tents-Puzzle

SAT solver in Prolog to find solutions for different configurations of the "Tents" problem (NP-problem).

Given a description of a problem instance (the size of the grid, the location of the trees using row column coordinates, a list with the number of tents per row and a list with the number of tents per column), it displays on the terminal the set of existing solutions when there is at least one.

The constraints of the problem are:

  • no two tents are adjacent, even diagonally
  • the number of tents in each row and column matches the numbers around the edge of the grid
  • each tree must have at least one tent by its side (above, below, left, or right). Two trees can share the same tent

Example of execution

Example of grid 10x10 with only one solution found:

example solution

About

Solver of the tents puzzle in Prolog reducing the problem to SAT

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages