* CrossWords Puzzles with context
@ 2019-06-23 18:06 Jorge Manuel
2019-06-24 3:52 ` Martin Althoff
0 siblings, 1 reply; 2+ messages in thread
From: Jorge Manuel @ 2019-06-23 18:06 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 2603 bytes --]
After some attempts to build crosswords puzzles with context, I found this approach:
1) Create the puzzle with genxword
https://github.com/riverrun/genxword <https://github.com/riverrun/genxword>
2) Edit the output table and change all {} to *
3) Save the table in a file (p.e. crosswords.txt)
3) In context use this script (Revised By Wolfgang Schuster)
\startluacode
context.startmidaligned()
context.bTABLE( { rulethickness = ".25pt", width = ".8cm", height = ".8cm", align = "{lohi, middle}" } )
for line in io.lines("crosswords.txt") do
for w in (line .. "|"):gmatch("([^|]*)|") do
-- print (w)
if w == ' ' then
context.bTR()
elseif w == '.' then
context.eTR()
else
if w == '* ' then
context.bTD( { frame = "off" } )
context.eTD()
else
ww = string.match (w, "%d+")
print (ww)
if ww then
context.bTD( { foregroundstyle = "\\bfxx" } )
context("%s",ww)
context.eTD()
else
context.bTD()
-- context("%s",w)
context.eTD()
end
end
end
end
end
context.eTABLE()
context.stopmidaligned()
\stopluacode
Files:
crossword.txt file:
|* |* |[2]T|* |* |* |* |* |* |* |* |* |* |* |* |* |.
|[1]A|D|R|I|A|N|O|* |* |* |* |* |* |* |* |* |.
|* |* |A|* |* |* |* |* |* |* |* |* |* |* |* |* |.
|[6]H|* |J|* |* |* |[4]T|* |* |* |* |* |* |* |* |* |.
|[3]I|T|A|L|I|C|A|* |* |* |* |* |* |* |* |* |.
|S|* |N|* |* |* |R|* |* |* |* |* |* |* |* |* |.
|P|* |O|* |* |* |G|* |[10]S|* |* |[7]P|* |* |* |* |.
|A|* |* |* |[5]G|U|A|D|A|L|Q|U|I|[9]V|I|[8]R|.
|L|* |* |* |* |* |R|* |N|* |* |B|* |E|* |O|.
|I|* |* |* |* |* |Y|* |T|* |* |L|* |N|* |M|.
|S|* |* |* |* |* |E|* |I|* |* |I|* |U|* |A|.
|* |* |* |* |* |* |N|* |P|* |* |O|* |S|* |N|.
|* |* |* |* |* |* |* |* |O|* |* |* |* |* |* |O|.
|* |* |* |* |* |* |* |* |N|* |* |* |* |* |* |S|.
|* |* |* |* |* |* |* |* |C|* |* |* |* |* |* |* |.
|* |* |* |[11]A|N|F|I|T|E|A|T|R|O|* |* |* |.
Output
[-- Attachment #1.2.1: Type: text/html, Size: 15030 bytes --]
[-- Attachment #1.2.2: crossW.png --]
[-- Type: image/png, Size: 9971 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: CrossWords Puzzles with context
2019-06-23 18:06 CrossWords Puzzles with context Jorge Manuel
@ 2019-06-24 3:52 ` Martin Althoff
0 siblings, 0 replies; 2+ messages in thread
From: Martin Althoff @ 2019-06-24 3:52 UTC (permalink / raw)
To: ntg-context
Thanks for sharing this! Great help for me as a teacher :)
On Sun, 2019-06-23 at 19:06 +0100, Jorge Manuel wrote:
> After some attempts to build crosswords puzzles with context, I found this approach:
>
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-24 3:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-23 18:06 CrossWords Puzzles with context Jorge Manuel
2019-06-24 3:52 ` Martin Althoff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).