-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsudoku.pro
14 lines (9 loc) · 1.03 KB
/
sudoku.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
%!bp -g "['sudoku.pro']"
%
% @author Manuel Ebert
% @system b-prolog
% Sudoku++
% Alright, this is going to be the forty-third Sudoku solver you implement in your course of study. Wait, since we are at the Institute of Cognitive Science we can always make things a bit more complicated than necessary!
% (a) Consider figure [sudoku.png]. Write a prolog program that solves the following constraint satisfaction problem: write the words "one", "two", "three", "four", "five" and "six" into the boxes such that every word occurs only once per row, column and 2x3 grid. The number of letters of the words in the grids within a dotted box must be equal.
% (b) Analyse the efficiency of your program and state where and by which means you improved your predicate over the no-brainer back-tracking way of doing it.
% (c) EXTRA CREDIT: design a similar sudoku++ problem and solve it (make sure the solution is unique). How much effort did it take you to adapt your program to the new problem? Analyse the efficiency again and compare with (b).