Created
December 21, 2018 15:38
-
-
Save DonaldKellett/fd53a4fe3f8e6c944e81336af58a71c3 to your computer and use it in GitHub Desktop.
Learn Prolog Now! - Chapter 2 - Exercise 2.4 - Crossword Solver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% The words to fill in for the crossword | |
word(astante, a,s,t,a,n,t,e). | |
word(astoria, a,s,t,o,r,i,a). | |
word(baratto, b,a,r,a,t,t,o). | |
word(cobalto, c,o,b,a,l,t,o). | |
word(pistola, p,i,s,t,o,l,a). | |
word(statale, s,t,a,t,a,l,e). | |
% A specification on how the crossword grid must be filled | |
crossword(W1, W2, W3, W4, W5, W6) :- | |
word(W1, _,H1V1,_,H2V1,_,H3V1,_), | |
word(W2, _,H1V2,_,H2V2,_,H3V2,_), | |
word(W3, _,H1V3,_,H2V3,_,H3V3,_), | |
word(W4, _,H1V1,_,H1V2,_,H1V3,_), | |
word(W5, _,H2V1,_,H2V2,_,H2V3,_), | |
word(W6, _,H3V1,_,H3V2,_,H3V3,_). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment