diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2016-09-30 16:57:23 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2016-09-30 16:59:06 +0200 |
commit | 724cc003460ec67eda269911da85c9f9e40aa6cf (patch) | |
tree | 14e27b45e04279516e4be546b15dcf6fafe17268 /prolog/puzzle | |
download | eumel-src-724cc003460ec67eda269911da85c9f9e40aa6cf.tar.gz eumel-src-724cc003460ec67eda269911da85c9f9e40aa6cf.tar.bz2 eumel-src-724cc003460ec67eda269911da85c9f9e40aa6cf.zip |
Add extracted sources from floppy disk images
Some files have no textual representation (yet) and were added as raw
dataspaces.
Diffstat (limited to 'prolog/puzzle')
-rw-r--r-- | prolog/puzzle | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/prolog/puzzle b/prolog/puzzle new file mode 100644 index 0000000..648beb6 --- /dev/null +++ b/prolog/puzzle @@ -0,0 +1,24 @@ + {Solution: 9,5,6,7,0,8,2} +puzzle:- repeat, permute ((9,8,7,6,5,2,0), SENDMORY), + write (SENDMORY), + puzzle (SENDMORY, SEND, MORE, MONEY), + elan (line), + write (SEND), write (+), + write (MORE), write (=), + write (MONEY). + +puzzle([S,E,N,D,O,R,Y], SEND, MORE, MONEY):- + SEND IS ((S * 10 + E) * 10 + N) * 10 + D, + MORE IS ((10 + O) * 10 + R) * 10 + E, + MONEY IS (((10 + O) * 10 + N) * 10 + E) * 10 + Y, + MONEY IS SEND + MORE. + +permute ([], []). +permute ([E|X], Z):- permute (X, Y), insert (E, Y, Z). + +insert (E, X, [E|X]). +insert (E, [F|X], [F|Y]):- insert (E, X, Y). + +repeat. +repeat:- repeat. + |