update to newer version

This commit is contained in:
Vitor Santos Costa
2012-10-08 18:27:05 +01:00
parent b0ddda1fde
commit c4da6a9c68
14 changed files with 338 additions and 469 deletions

View File

@@ -2,11 +2,11 @@
% SEND + MORE = MONEY
% Adapted from: http://en.wikipedia.org/wiki/Constraint_programming
:- use_module(library(clpfd)).
:- use_module(library('bounds')).
sendmore(Digits) :-
Digits = [S,E,N,D,M,O,R,Y], % Create variables
allin(Digits, 0..9), % Associate domains to variables
Digits in 0..9, % Associate domains to variables
S #\= 0, % Constraint: S must be different from 0
M #\= 0,
all_different(Digits), % all the elements must take different values
@@ -15,8 +15,3 @@ sendmore(Digits) :-
#= 10000*M + 1000*O + 100*N + 10*E + Y,
label(Digits). % Start the search
allin([],_).
allin([Pos|Board],D) :-
Pos in D,
allin(Board,D).