Example #1
0
 def test_after(self):
     # This isn't a valid sequence of moves, but it tests
     # out the board manipulation functions.
     self.assertEquals(
         terratri.boardToGrid('  _B '
                              '   L '
                              '  Rr '
                              '  .  '
                              '  .  '), terratri.after('nnEFfeSF'))
Example #2
0
 def test_toGrid(self):
     self.assertEquals(
         [[' ', ' ', '_', '_', ' '], [' ', ' ', 'b', 'B', ' '],
          [' ', 'r', ' ', ' ', ' '], [' ', '.', ' ', ' ', ' '],
          [' ', 'R', '.', ' ', ' ']],
         terratri.boardToGrid('  __ '
                              '  bB '
                              ' r   '
                              ' .   '
                              ' R.  '))
Example #3
0
 def test_after(self):
     # This isn't a valid sequence of moves, but it tests
     # out the board manipulation functions.
     self.assertEquals(
         terratri.boardToGrid(
          '  _B '
          '   L '
          '  Rr '
          '  .  '
          '  .  '),
         terratri.after('nnEFfeSF'))
Example #4
0
 def test_toGrid(self):
     self.assertEquals(
         [[' ', ' ', '_', '_', ' '],
          [' ', ' ', 'b', 'B', ' '],
          [' ', 'r', ' ', ' ', ' '],
          [' ', '.', ' ', ' ', ' '],
          [' ', 'R', '.', ' ', ' ']],
         terratri.boardToGrid(
             '  __ '
             '  bB '
             ' r   '
             ' .   '
             ' R.  '))
Example #5
0
 def validSteps(self):
     if self.game.whoseTurn:
         grid = terratri.boardToGrid(self.game.board)
         return terratri.validSteps(self.game.whoseTurn, grid, self.game.steps)
     else:
         return {}