crossword

Empty crossword solver in Python

僤鯓⒐⒋嵵緔 提交于 2020-02-23 09:50:49
问题 I'm given a matrix containing a blueprint of a crossword puzzle - unfilled, of course. The goal is to fill the whole puzzle - it's a task from Checkio, and I've been struggling with this for quite some time now. From what I understand of complexity, there's no perfect algorithm for this problem. Still, there has to be the best way to do this, right? I've tried some different things, and results were not that good with increasing number of words in the crossword and/or dictionary. So, some of

How to generate a word search grid that enables words using the same letter

时光总嘲笑我的痴心妄想 提交于 2020-01-15 15:26:58
问题 I'm trying to make a word-search grid with a list of given words. My problem is that some of the words don't appear properly. I have updated the code, see below I have tried to fix the previous error and now I am getting an out of range error that i cant fix, if anyone can help I would appreciate Note 1: I didnt include all the program functions, if required I will include them later The program takes in a text file like this: 9 9 white black blue green pink yellow red grey purple where the

Force Prolog to choose unique values of variables

早过忘川 提交于 2019-12-28 22:03:42
问题 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

How to fill in the parameters of predicates by input in prolog?

半城伤御伤魂 提交于 2019-12-11 08:27:50
问题 I have the following code : size(5). black(1,3). black(2,3). black(3,2). black(4,3). black(5,1). black(5,5). words([do,ore,ma,lis,ur,as,po, so,pirus, oker,al,adam, ik]) . :- use_module(library(lists),[nth1/3, select/3]). crossword(Puzzle) :- words(WordList), word2chars(WordList,CharsList), make_empty_words(EmptyWords) , fill_in(CharsList,EmptyWords), word2chars(Puzzle,EmptyWords). word2chars([],[]). word2chars([Word|RestWords] ,[Chars|RestChars] ) :- atom_chars(Word,Chars), word2chars

Solving a wordsearch and delete the found characters

本小妞迷上赌 提交于 2019-12-10 12:23:32
问题 This is the problem: To solve the puzzle you need to search and then delete from the wordsearch all the OCCURRENCES (if multiple) of the words in the list. The letters of the diagram that will remain, taken all in their order by rows and by columns, they will form the solution of the game. Words can appear in the diagram horizontally (from right to left, or from left to right), vertically (downwards or downwards towards the top) and diagonally (from top to bottom or from bottom to top).

PHP: Script for generating Crossword game?

匆匆过客 提交于 2019-12-05 09:59:56
问题 I need an script for generating crossword game. I have a list of 8 words for which I wnat to generate a crossword game, let's say for 15 column and 15 row. I am not getting the concept of this problem. How to generate this using PHP ?? Can anyone tell me how to do that ?? 回答1: I think that sounds easier than it is in practice, certainly when you only start with a list of 15-20 words. It is very difficult this way to put those words into a crossword. In most cases it will even be impossible...

Crossword solver in PROLOG

安稳与你 提交于 2019-12-04 23:10:51
问题 The creole of Paradise Island has 14 words: "abandon", "abalone", "anagram", "boat", "boatman", "child", "connect", "elegant", "enhance", "island", "man", "sand", "sun", and "woman". The Paradise Times have published this crossword: The crossword contains some of the 14 words but no other words. Write a Prolog program that starts from word(X) :- member(X, [ [a,b,a,n,d,o,n], [a,b,a,l,o,n,e], [a,n,a,g,r,a,m], [b,o,a,t], [b,o,a,t,m,a,n], [c,h,i,l,d], [c,o,n,n,e,c,t], [e,l,e,g,a,n,t], [e,n,h,a,n

PHP: Script for generating Crossword game?

a 夏天 提交于 2019-12-03 21:44:33
I need an script for generating crossword game. I have a list of 8 words for which I wnat to generate a crossword game, let's say for 15 column and 15 row. I am not getting the concept of this problem. How to generate this using PHP ?? Can anyone tell me how to do that ?? I think that sounds easier than it is in practice, certainly when you only start with a list of 15-20 words. It is very difficult this way to put those words into a crossword. In most cases it will even be impossible... I think this is a fun idea and i will try that some time, should be possible. Of couse you never know if

Learning Prolog: solving a crossword scheme

前提是你 提交于 2019-11-30 09:41:28
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). 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). Write a