[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Printed OutCrosswords (was : Re: [seul-edu] Crosswords basic generator released )
El Dom 13 Ene 2002 12:28, escribió:
> El Dom 13 Ene 2002 03:02, escribió:
>
> def printout_Solution_Page(file, lines):
> f = open(file, "w")
> for i in lines:
> if i[0] == '-':
> f.write(i)
> f.close()
>
> def printout_Student_Page(file, lines):
> f = open(file, "w")
> for i in lines:
> if i[0] != '-':
> f.write(i)
> else:
> for j in i[:-1]:
> if j ==' ': continue
> if j=='-' :
> print "-",
> f.write("-")
> else:
> print " ",
> f.write(" ")
> print
> f.write("\n")
> f.close()
>
> nm1 ="name_of_file_where_you_have_stored_the_above_crossword"
> nm2 ="File of Solution"
> nm3 ="File of Sutdent Page"
>
> nm1= "a"
> nm2= "b"
> nm3= "c"
>
> f = open(nm1, "r")
> l = f.readlines()
> f.close()
> printout_Solution_Page(nm2, l)
> printout_Student_Page(nm3, l)
>
>
Well, the above program isn't much interesting because it generates:
---------------
------------- -
---- -
---------- -- -
--- - -
---- ----- -- -
---- - --- -- -
- ---- -
---- - --------
------ ----
------ - ------
-------- --
-------- - ----
---------- ----
---------------
(2, 14) DOWN gateria
(3, 5) ACROSS disciplina
(3, 11) DOWN lloro
(5, 4) ACROSS confusion
(5, 5) DOWN orden
(8, 2) ACROSS embeleco
(7, 7) DOWN pesar
(10, 7) ACROSS aereo
(10, 9) DOWN risa
(12, 9) ACROSS solfa
(12, 11) DOWN lio
So, it's not a real crossword , for that you have to substitute each "word"
for its definition, parsing things like this (available in the web page) or
creating your own:
macro &-&-& ____ package allows you to query inside a macro &/&/&
outline &-&-& Mode that hides some code, useful for python &/&/&
info &-&-& Format preferred by emacs for its own help &/&/&
Besides, to generate some other words- without learning python- just replace
the words in the source code.
---
MGA