# Różnice

Różnice między wybraną wersją a wersją aktualną.

 — pl:prolog:pllib:cryptoarithmetic_puzzle [2019/06/27 15:50] (aktualna) Linia 1: Linia 1: + ====== Cryptoarithmetic puzzle ====== + {{tag>​puzzle CLP}} + ===== Description ===== + A cryptarithmetic puzzle in CLP(FD). + + **Source**: ​ PROLOG programming for artificial intelligence,​ 3rd Edition, Harlow, 2001, ISBN 0-201-40375-7. + ===== Download ===== + Program source code: {{cryptoarithmetic_puzzle.pl}} + ===== Listing ===== + + % Figure 14.8  A cryptarithmetic puzzle in CLP(FD). + + + % Cryptarithmetic puzzle DONALD+GERALD=ROBERT in CLP(FD) + + solve( [D,​O,​N,​A,​L,​D],​ [G,​E,​R,​A,​L,​D],​ [R,​O,​B,​E,​R,​T]) ​ :- + Vars = [D,​O,​N,​A,​L,​G,​E,​R,​B,​T], ​                    % All variables in the puzzle + domain( Vars, 0, 9),                              % They are all decimal digits + all_different( Vars), ​                            % They are all different + 100000*D + 10000*O + 1000*N + 100*A + 10*L + D  + + 100000*G + 10000*E + 1000*R + 100*A + 10*L + D  = + 100000*R + 10000*O + 1000*B + 100*E + 10*R + T, + labeling( [], Vars). + + ​ + ===== Comments =====
pl/prolog/pllib/cryptoarithmetic_puzzle.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)