예제 #1
0
def test_state():
    random.seed(1234)
    state = TwentyFortyEight().state
    expected_state = {
        'board': [[2, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 2, 0]],
        'score': 0,
        'gameover': False,
    }
    assert state == expected_state
예제 #2
0
def test_blank_board_rows_cols():
    expected_num_position = 2
    game = TwentyFortyEight(rows=2, cols=2)
    available_positions = game._get_available_positions()
    assert available_positions is not None
    assert len(available_positions) == expected_num_position