tasks a-s

This commit is contained in:
Ingy döt Net 2013-04-10 23:57:08 -07:00
parent 47bf37c096
commit b83f433714
12433 changed files with 156208 additions and 123 deletions

View file

@ -0,0 +1,19 @@
:- use_module(library(clpfd)).
puzzle(Ts, X, Y, Z) :-
Ts = [ [151],
[_, _],
[40, _, _],
[_, _, _, _],
[X, 11, Y, 4, Z]],
Y #= X + Z, triangle(Ts), append(Ts, Vs), Vs ins 0..sup, label(Vs).
triangle([T|Ts]) :- ( Ts = [N|_] -> triangle_(T, N), triangle(Ts) ; true ).
triangle_([], _).
triangle_([T|Ts], [A,B|Rest]) :- T #= A + B, triangle_(Ts, [B|Rest]).
% ?- puzzle(_,X,Y,Z).
% X = 5,
% Y = 13,
% Z = 8 ;