示例#1
0
def test_computer_make_move():
    t = Tiles(800, 100, 90)
    gm = GameManager(t)
    gm.player_make_move(250, 350)
    gm.computer_make_move()
    assert gm.num_of_tiles == 6
    assert gm.player_turn is True
    assert gm.tiles.white_num == 3
示例#2
0
def test_forecast():
    t = Tiles(800, 100, 90)
    gm = GameManager(t)
    gm.player_make_move(250, 350)
    gm.computer_make_move()
    gm.player_make_move(350, 250)
    mock_squares = copy.deepcopy(gm.tiles.squares)
    mock_player_tiles = copy.deepcopy(gm.tiles.player_tiles)
    mock_computer_tiles = copy.deepcopy(gm.tiles.computer_tiles)
    assert gm.forecast(mock_squares, mock_player_tiles, mock_computer_tiles,
                       [(3, 2), (4, 3)], 4, 2) == 9
示例#3
0
def test_computer_make_move():
    # test case that no legal move
    game = GameManager(2, 2, 80)
    game.turn = 1
    game.computer_make_move()
    assert game.turn == 0
    # test case that has legal move
    game = GameManager(6, 6, 80)
    game.turn = 1
    game.computer_make_move()
    assert game.tiles_list[1][3].color == game.WHITE
    assert game.tiles_list[2][3].color == game.WHITE
    assert game.turn == 0