Beispiel #1
0
 def goto(self, index):
     currentBoard = self.mainarea.getRepresentation()
     self.index = index
     newBoard = wordClassListToGrid(currentBoard,
                                    self.solutions[1][self.index],
                                    self.solutions[0])
     self.mainarea.redraw(newBoard)
Beispiel #2
0
 def next(self):
     currentBoard = self.mainarea.getRepresentation()
     self.index += 1
     self.index %= len(self.solutions[1])
     newBoard = wordClassListToGrid(currentBoard,
                                    self.solutions[1][self.index],
                                    self.solutions[0])
     self.mainarea.redraw(newBoard)
Beispiel #3
0
 def solve(self):
     currentBoard = self.mainarea.getRepresentation()
     self.mainarea.setNumbers()
     self.mainarea.drawNumbers()
     self.mainarea.disable()
     self.update()
     printGrid(currentBoard)
     self.solutions = solve(gridToWordClassList(currentBoard))
     self.bottombar.reset(len(self.solutions[1]))
     newBoard = wordClassListToGrid(currentBoard, self.solutions[1][0],
                                    self.solutions[0])
     self.mainarea.redraw(newBoard)
Beispiel #4
0
 def test_wordClassListToGrid(self):
     wids = [WordId(ith=4, dir='Across'), WordId(ith=3, dir='Down'), WordId(ith=2, dir='Down'), WordId(ith=1, dir='Across')]
     solution = ["in", "an", "ye", "bye"]
     expected = [['b', 'y', 'e', '#'], ['#', 'e', '#', 'a'], ['#', '#', 'i', 'n']]
     filledInGrid = wordClassListToGrid(self.example1, solution, wids)
     self.assertEqual(filledInGrid, expected)