Warning! It seems that you are using Dodona within another webpage, so not everything may work properly. Let your teacher know so that he can solve the problem by adjusting a setting in the learning environment. In the meantime, you can click this link to open Dodona in a new window.
Suguru solver
Sign in to test your solution.
:- use_module(library(clpfd)).
solution(Field,OnlyVars) :-
...
only_vars(X,Y) :-
maplist(only_vars_, X, Y).
only_vars_(X, Y) :-
maplist([A,B]>> (A=_-B), X, Y).
main :-
% May take some seconds
% 91,321,825 inferences, 8.238 CPU in 8.336 seconds (99% CPU, 11085915 Lips)
Field = [
[ 1-_, 2-_, 2-_, 2-_, 2-_, 3-_, 4-_, 4-1],
[ 1-_, 1-_, 1-5, 2-_, 3-_, 3-_, 3-_, 4-_],
[ 1-_, 5-_, 6-_, 6-_, 6-_, 3-3, 8-_, 4-_],
[ 5-_, 5-_, 5-_, 6-_, 7-_, 7-_, 8-_, 9-_],
[14-_, 5-_, 7-_, 7-_, 7-_, 10-_, 9-_, 9-_],
[14-_, 14-1, 14-_, 11-_, 10-3, 10-_, 10-_, 9-_],
[12-_, 12-3, 11-_, 11-_, 11-_, 10-1, 13-2, 9-_],
[12-_, 12-_, 12-4, 11-_, 13-_, 13-_, 13-_, 13-_]
],
solution(Field, OnlyVars),
maplist(portray_clause, OnlyVars).
You can submit as many times as you like. Only your latest submission will be taken into account.
Sign in to test your solution.