crossword

Learning Prolog: solving a crossword scheme

两盒软妹~` 提交于 2019-11-29 15:12:59
问题 I'm trying to learn Prolog following the tutorials on this site and I can't find a solution to an exercise (and there's no solution on the site). Here's what I have to do: Here are six Italian words: astante , astoria , baratto , cobalto , pistola , statale . They are to be arranged, crossword puzzle fashion, in the following grid: The following knowledge base represents a lexicon containing these words: 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).

Force Prolog to choose unique values of variables

僤鯓⒐⒋嵵緔 提交于 2019-11-28 12:12:13
OK I am new to Prolog, so excuse me if this is something trivial, but I can't seem to find a proper elegant answer to this. I am trying to work out the exercise here on learnprolognow.org , exercise 2.4 (the crossword). The exercise provides these facts: 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). And the solution I came up with to solve the crossword placement of each word is this: crossword(V1, V2, V3, H1, H2, H3) :- word(V1, V1a, V1bH1b, V1c, V1dH2b, V1e,

Algorithm to generate a crossword

安稳与你 提交于 2019-11-26 14:48:58
Given a list of words, how would you go about arranging them into a crossword grid? It wouldn't have to be like a "proper" crossword puzzle which is symmetrical or anything like that: basically just output a starting position and direction for each word. Would there be any Java examples available? I came up with a solution which probably isn't the most efficient, but it works well enough. Basically: Sort all the words by length, descending. Take the first word and place it on the board. Take the next word. Search through all the words that are already on the board and see if there are any

Algorithm to generate a crossword

左心房为你撑大大i 提交于 2019-11-26 03:46:46
问题 Given a list of words, how would you go about arranging them into a crossword grid? It wouldn\'t have to be like a \"proper\" crossword puzzle which is symmetrical or anything like that: basically just output a starting position and direction for each word. Would there be any Java examples available? 回答1: I came up with a solution which probably isn't the most efficient, but it works well enough. Basically: Sort all the words by length, descending. Take the first word and place it on the