def test(): S = "()" res = score(S) assert res == 1 assert score(S) == score_2(S) S = '(())' # pudb.set_trace() res = score_2(S) assert res == 2 S = '()()' res = score(S) assert res == 2 assert score(S) == score_2(S) S = '(()(()))' res = score(S) assert res == 6 assert score(S) == score_2(S)
def test_score(): assert score(deque([3, 2, 10, 6, 8, 5, 9, 4, 7, 1])) == 306
win = pygame.display.set_mode((900, 1000)) player = 0 score_1 = 0 score_2 = 0 while True: player = int(player == 0) map_ = np.array([[-1, -1, -1], [-1, -1, -1], [-1, -1, -1]]) win.fill((0, 0, 0)) pygame.display.update() if player == 0: state, pos = score(map_, int(player == 0)) map_[pos[0], pos[1]] = int(player == 0) while is_leaf(map_) == 0: draw_window(win, map_, score_1, score_2) for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() if event.type == pygame.MOUSEBUTTONDOWN: x = event.pos[0] // 300 y = event.pos[1] // 300 if map_[y, x] == -1: map_[y, x] = player state, pos = score(map_, int(player == 0)) if pos is not None: map_[pos[0], pos[1]] = int(player == 0)
def test_worthless_case(dice, result): assert score(dice) == result
def test_mixed_cases(dice, result): assert score(dice) == result
def test_base_cases(dice, result): assert score(dice) == result