Exemplo n.º 1
0
def test_tile_numbers():
    gc = GameController(400, 400)
    new_board = Board(400, 400, 100, gc)
    new_board.begin()
    new_board.table[3][2] = "B"
    new_board.tile_numbers()
    assert new_board.black == 3
    assert new_board.white == 2
Exemplo n.º 2
0
def test_begin():
    gc = GameController(800, 800)
    new_board = Board(800, 800, 100, gc)
    new_board.begin()
    assert new_board.table[3][3] == "W"
    assert new_board.table[4][4] == "W"
    gc_mini = GameController(200, 200)
    mini_board = Board(200, 200, 100, gc_mini)
    mini_board.begin()
    assert mini_board.table[0][0] == "W"
    assert mini_board.table[1][1] == "W"
    assert mini_board.table[0][1] == "B"
    assert mini_board.table[1][0] == "B"
Exemplo n.º 3
0
def test_playerMove_pcMove():
    gc = GameController(40, 40)
    new_board = Board(40, 40, 10, gc)
    new_board.begin()
    new_board.playerMove(22, 35)
    assert new_board.table == [[1, 2, 3, 4], [1, "W", "B", 4],
                               [1, "B", "B", 4], [1, 2, "B", 4]]
    new_board.pcMove()
    assert new_board.table == [[1, 2, 3, 4],
                               [1, "W", "W", "W"],
                               [1, "B", "B", 4],
                               [1, 2, "B", 4]] or\
                              [[1, 2, 3, 4],
                               [1, "W", "B", 4],
                               [1, "W", "B", 4],
                               [1, "W", "B", 4]] or\
                              [[1, 2, 3, 4],
                               [1, "W", "B", 4],
                               [1, "B", "W", 4],
                               [1, 2, "B", "W"]]
Exemplo n.º 4
0
def test_legalMoves():
    gc = GameController(400, 400)
    new_board = Board(400, 400, 100, gc)
    new_board.begin()
    legal_move = new_board.legalMoves("B", "W")
    assert legal_move == {(0, 1): 1, (1, 0): 1, (2, 3): 1, (3, 2): 1}