]> git.sommitrealweird.co.uk Git - curses-crossword.git/blobdiff - curses-crossword.py
Encode clues in real charset...
[curses-crossword.git] / curses-crossword.py
index d11568a2ebedf894e1b70216b1df5688514ef7a7..06d944ea3d3dbd13484792d45394b23e48a32729 100644 (file)
@@ -27,7 +27,7 @@ except:
     for number in range(0,10):
         superscript_numbers[str(number)] = str(number)
 
-crossworddata = codecs.open("g2-20090701.txt", "r", "utf-8").read()
+crossworddata = codecs.open("crossword.output", "r", "utf-8").read()
 
 def parsecrossword(crossworddata):
     ingrid = False
@@ -58,13 +58,13 @@ def parsecrossword(crossworddata):
                     parts = line.split()
                     question_number = int(parts[0])
                     clue = " ".join(parts[1:])
-                    crossword["across"][int(question_number)] = clue
+                    crossword["across"][int(question_number)] = clue.encode('utf-8')
             if indown:
                 if line != "":
                     parts = line.split()
                     question_number = int(parts[0])
                     clue = " ".join(parts[1:])
-                    crossword["down"][int(question_number)] = clue
+                    crossword["down"][int(question_number)] = clue.encode('utf-8')
     num_cols = len(crossword["grid"][0])
     num_rows = len(crossword["grid"])
 
@@ -178,7 +178,12 @@ def crossword(stdscr, crossworddata):
     gridx = 0
     gridy = 0
 
-    stdscr.move(1,3)
+    while crossword["grid"][gridy][gridx] == "x":
+        curx += 4
+        gridx += 1
+
+    stdscr.move(cury,curx)
+
     while 1:
         c = stdscr.getch()
         if c == curses.ascii.ESC: