Ejemplo n.º 1
0
 def makeMove(self, move, user):
     # TODO: finish this, check for win, right player, etc...
     self.game.steps += move
     grid = terratri.after(self.game.steps)
     self.game.board = terratri.gridToBoard(grid)
     self.game.winner = terratri.winner(grid)
     self.game.whoseTurn = "" if self.game.winner else terratri.whoseTurn(self.game.steps)
     self.game.put()
     self.sendUpdate()
Ejemplo n.º 2
0
 def test_toBoard(self):
     self.assertEquals(('  __ '
                        '  bB '
                        ' r   '
                        ' .   '
                        ' R.  '),
                       terratri.gridToBoard([[' ', ' ', '_', '_', ' '],
                                             [' ', ' ', 'b', 'B', ' '],
                                             [' ', 'r', ' ', ' ', ' '],
                                             [' ', '.', ' ', ' ', ' '],
                                             [' ', 'R', '.', ' ', ' ']]))
Ejemplo n.º 3
0
 def test_toBoard(self):
     self.assertEquals((
         '  __ '
         '  bB '
         ' r   '
         ' .   '
         ' R.  '),
         terratri.gridToBoard(
             [[' ', ' ', '_', '_', ' '],
              [' ', ' ', 'b', 'B', ' '],
              [' ', 'r', ' ', ' ', ' '],
              [' ', '.', ' ', ' ', ' '],
              [' ', 'R', '.', ' ', ' ']]))