Skip to content

A Kakuro Puzzle solver witten in Prolog, in pure declarative Logic Programming fashion.

Notifications You must be signed in to change notification settings

Vadstena/kakuro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kakuro Puzzle Solver

A Kakuro Puzzle solver witten in Prolog, in pure declarative Logic Programming fashion.

Description

Format of a Puzzle: a list of sublists, where each sublist is a row of the Puzzle. Elements of a sublist can be variables, i.e. empty positions, or a list of two elements, [S_v, S_h], respectively, vertical and horizontal sums. If either sum does not exist it is represented by 0. Example:

Puzzle representation

puzzles_publicos.pl contains more examples.

Getting Started

Dependencies

  • SWI-Prolog
  • library(clpfd)

Executing program

Open SWI-Prolog. In SWI-Prolog's REPL input

working_directory(_, <path/to/proj.pl>).

to change directories. proj.pl imports codigo_comum.pl, which contains auxiliary code provided by teachers. Once proj.pl is loaded

['proj.pl'].

then, a Puzzle can be solved with the query:

Puzzle = [...], resolve(Puzzle), escreve_Puzzle(Puzzle).

escreve_Puzzle prints the Puzzle

Unsolved Puzzle

and resolve(Puzzle) solves it

Solved Puzzle

Multiple Solutions

If a Puzzle has multiple solutions, subsequent solutions can queried by typing ;

Multiple Solutions

About

A Kakuro Puzzle solver witten in Prolog, in pure declarative Logic Programming fashion.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages