コード例 #1
0
ファイル: tests.py プロジェクト: willij6/niya-solver
 def test_victory_via_no_moves(self):
     # make a board full of the same tile
     pieces = [[tile(0, 0) for i in range(4)] for j in range(4)]
     # set the Previous Tile to something incompatible
     board = Position(pieces, black(), tile(1, 1))
     # black to move, so red wins
     self.assertEqual(board.check_victory(), red())
     # now reverse the roles and check again
     board = Position(pieces, red(), tile(1, 1))
     self.assertEqual(board.check_victory(), black())
コード例 #2
0
ファイル: tests.py プロジェクト: willij6/niya-solver
 def test_moves_with_previous(self):
     pieces = self.pieces
     board = Position(pieces,black(),tile(0,0))
     # all the pieces close to tile(0,0)
     analogous = [tile(i,0) for i in range(4)] + \
                 [tile(0,i) for i in range(4)]
     moves = board.get_moves()
     self.assertGreater(len(moves),0)
     for move in moves:
         (i,j) = move.get_location()
         self.assertIn(pieces[i][j],analogous)
コード例 #3
0
ファイル: tests.py プロジェクト: willij6/niya-solver
 def test_moves_with_previous(self):
     pieces = self.pieces
     board = Position(pieces, black(), tile(0, 0))
     # all the pieces close to tile(0,0)
     analogous = [tile(i,0) for i in range(4)] + \
                 [tile(0,i) for i in range(4)]
     moves = board.get_moves()
     self.assertGreater(len(moves), 0)
     for move in moves:
         (i, j) = move.get_location()
         self.assertIn(pieces[i][j], analogous)
コード例 #4
0
ファイル: tests.py プロジェクト: willij6/niya-solver
 def test_victory_via_no_moves(self):
     # make a board full of the same tile
     pieces = [[tile(0,0) for i in range(4)] for j in range(4)]
     # set the Previous Tile to something incompatible
     board = Position(pieces,black(),
                               tile(1,1))
     # black to move, so red wins
     self.assertEqual(board.check_victory(),red())
     # now reverse the roles and check again
     board = Position(pieces,red(),
                               tile(1,1))
     self.assertEqual(board.check_victory(),black())
コード例 #5
0
ファイル: tests.py プロジェクト: willij6/niya-solver
 def setUp(self):
     pieces = [[tile(i,j) for i in range(4)] for j in range(4)]
     self.pieces = pieces
コード例 #6
0
ファイル: tests.py プロジェクト: willij6/niya-solver
 def setUp(self):
     pieces = [[tile(i, j) for i in range(4)] for j in range(4)]
     self.pieces = pieces