Generating crossword frameworks
From: Nameless (news.mail_at_chello.no)
Date: 04/14/04
- Previous message: Neil: "Is Prolog a good tool for this kind of problem?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 14 Apr 2004 05:07:16 +0200
"reader" wrote in message
news:a9Zec.5489$Fo4.66948@typhoon.sonic.net...
>. . .
> When I visualize a crossword puzzle, I see a matrix in which
> some cells are blacked out, so that's how I would represent it.
>
> Accordingly, in PDC Prolog, I might say
>
> domains
> TEMPLATE = ROW*
> ROW = CELL*
> CELL = is(CHAR) ; nil
>
> and a puzzle layout like
>
> _ _ _ _ x x
> _ x x x x _
> _ _ _ _ _ _
> _ x _ x x _
> _ x _ _ _ x
> x x x _ x x
> _ _ _ _ _ x
>
> would be represented by
>
> predicates
> puzzle(TEMPLATE)
> clauses
> puzzle([
> [_,_,_,_,nil,nil],
> [_,nil,nil,nil,nil,_],
> [_,_,_,_,_,_],
> [_,nil,_,nil,nil,_],
> [_,nil,_,_,_,nil],
> [nil,nil,nil,_,nil,nil],
> [_,_,_,_,_,nil]
> ]).
>. . .
A more interesting challenge would be how to efficiently
generate a 'random' crossword framework (pattern) given a
number of constraints such as grid/matrix size, minimum and
maximum site (word) length, and no isolated sites (there
exists a path from any one site to another).
For those readers who are game enough to try, here's a
concrete example problem:
Write a Prolog programme which will generate a 'random'
crossword framework given the following constraints:
- Matrix: 10x10
- Min. site length: 2
- Max. site length: 6
- At least one site shall be max. site length
- No isolated sites
The programme should facilitate use of other values than
the first three given above, i.e. the programme should
be generic.
It would be interesting to see and discuss solutions here.
-- Mail sent to this email address is automatically deleted (unread) on the server. Send replies to the newsgroup.
- Previous message: Neil: "Is Prolog a good tool for this kind of problem?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|