A Belgian newspaper asks you to come up with a crossword puzzle of the following format:
This leading source of logic news gives you a list of allowed words as prolog facts (obviously). An excerpt is shown below
word(eerroof,e,e,r,r,o,o,f).
word(haargel,h,a,a,r,g,e,l).
word(kogelas,k,o,g,e,l,a,s).
word(infomap,i,n,f,o,m,a,p).
word(lasagne,l,a,s,a,g,n,e).
word(gameboy,g,a,m,e,b,o,y).
Write a predicate crossword/6
that unifies its argument with words that can be used to fill the grid. The first three arguments give the vertical words (left to right), the last three arguments represent the horizontal words (top to bottom). That is crosswords(V1,V2,V3,H1,H2,H3)
.
To test your code you can start with the small database given above (download1). Once you have figured that one out, you can look at the database of all dutch 7-letter words2. Although is is not required for this exercise, it is more fun if you make sure all arguments are distinct.