Beispiel #1
0
 def test_player_1_big(self):
     board = np.array([
              [0,  0,  0,  1,  0, -1,  0,  0,  0,], 
              [0,  0,  0,  1,  0, -1,  0,  0,  0,],
              [0,  0,  0,  1,  0, -1,  0,  0,  0,],
              [0,  0,  0,  1, -1,  0,  0, -1,  0,],
              [1,  1,  1, -1,  0, -1, -1,  0,  0,],
              [0,  0,  0,  1, -1,  0,  0, -1, -1,],
              [0,  0,  0,  1,  0, -1,  0,  0,  0,],
              [0,  0,  0,  1,  0, -1,  0,  1,  0,],
              [0,  0,  0,  0,  0, -1,  0,  0,  0,],
     ])
     target = np.array([
              [1,  1,  1,  2,  0, -2, -1, -1, -1,], 
              [1,  1,  1,  2,  0, -2, -1, -1, -1,],
              [1,  1,  1,  2,  0, -2, -1, -1, -1,],
              [1,  1,  1,  2, -2, -1, -1, -2, -1,],
              [2,  2,  2, -2, -1, -2, -2, -1, -1,],
              [0,  0,  0,  2, -2,  0,  0, -2, -2,],
              [0,  0,  0,  2,  0, -2,  0,  0,  0,],
              [0,  0,  0,  2,  0, -2,  0,  2,  0,],
              [0,  0,  0,  0,  0, -2,  0,  0,  0,],
     ]) 
     colored1 = color_board(board,  1)
     colored2 = color_board(board, -1)
     total = colored1 + colored2
     self.assertEqualList(total, target)
Beispiel #2
0
 def test_coloring_player_1(self):
     board = np.array([[1, 1, 1], [1, 0, 1], [1, 1, 1]])
     target = np.array([[1, 1, 1], [1, 1, 1], [1, 1, 1]])
     self.assertEqualList(color_board(board, 1), target)
     board = np.array([[1, 1, 1, -1, -1, -1], [1, 0, 1, -1, 0, -1],
                       [1, 1, 1, -1, -1, -1]])
     target = np.array([[1, 1, 1, -1, -1, -1], [1, 1, 1, -1, 0, -1],
                        [1, 1, 1, -1, -1, -1]])
     self.assertEqualList(color_board(board, 1), target)