Prolog Assignment 1.. Need Help!!

profileWolverineX
myp1.pdf

Objectives: The Numberlink puzzle requires to connect number pairs on a grid without crossing paths. Paths have to be continuous and can only move horizontally or vertically, not diagonally. The successful result has to have touched on each cell in the grid with some path (i.e. no unused cells). One example problem setting and a solution:

In this assignment, you are to write a Prolog program that solves the numberlink puzzle for any board size and any given board configuration using constraints.

Input: For the Numberlink board configuration above, you would receive the input in the format (board dimensions, n (=number of pairs), (n: p1 start, p1 end), ..., (pn start, pn end)). For the example here:

(7, 5,

(1: (3,6), (5,3)),

(2: (5,2), (1,7)),

(3: (2,2), (4,3)),

(4: (4,1), (5,7)),

(5: (6,2), (4,4)))

1

Output: For the same problem, a correct answer would be:

(7, 5,

(1: (3,6), (3,5), (4,5), (5,5), (5,4), (5,3)),

(2: (5,2), (4,2), (3,2), (3,1), (2,1), (1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (1,7)),

(3: (2,2), (2,3), (3,3), (4,3)),

(4: (4,1), (5,1), (6,1), (7,1), (7,2), (7,3), (7,4), (7,5), (7,6), (7,7), (6,7), (5,7)),

(5: (6,2), (6,3), (6,4), (6,5), (6,6), (5,6), (4,6), (4,7), (3,7), (2,7), (2,6), (2,5),

(2,4), (3,4),(4,4)))

Deliverables:

• Code: check in code that runs on the lab machines (in .pl format)

• Test cases: show test cases that convinced you (and that should convine us) that your code is correct (in .txt format)

• Challenge board run: we will give you a new board configuration the day before the due date. You have to include the input-output configurations for that problem (in .txt format)

• Report: a brief report that describes all the design decisions you made while implementing the Prolog program (in .pdf format)

2