to be send+more=money
question be2 that is
+ be1 to1 the be2
= be1 to1 that be2 or
MiniZinc model
include "globals.mzn";
array[0..9] of string: s = array1d(0..9, ["to1",
"be1",
"or",
"not",
"to2",
"be2",
"that",
"is",
"the",
"question"]);
var 0..9: S; var 0..9: E; var 0..9: N; var 0..9: D;
var 0..9: M; var 0..9: O; var 0..9: R; var 0..9: Y;
array[1..8] of var int : fd =
[S,E,N,D,M,O,R,Y];
solve satisfy;
constraint
all_different(fd) /\
1000*S + 100*E + 10*N + D +
1000*M + 100*O + 10*R + E =
10000*M + 1000*O + 100*N + 10*E + Y
/\
S > 0 /\ M > 0
;
output [
" ", show(s[fix(S)]), " ", show(s[fix(E)]), " ", show(s[fix(N)]), " ", show(s[fix(D)]),"\n",
" + ", show(s[fix(M)]), " ", show(s[fix(O)]), " ", show(s[fix(R)]), " ", show(s[fix(E)]),"\n",
" = ", show(s[fix(M)]), " ", show(s[fix(O)]), " ", show(s[fix(N)]), " ", show(s[fix(E)]), " ", show(s[fix(Y)]), "\n"
]
;
Back to Constrained-based constraint poetry
Created by Hakan Kjellerstrand hakank@gmail.com