Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = 170
- a = [[None] * m for _ in range(m)] # +- выиграл/проиграл и за сколько ходов
- b = [[False] * m for _ in range(m)] # можно ли сейчас «подставиться»
- for i in range(m - 1, 0, -1):
- for j in range(m - 1, 0, -1):
- if i + j >= 79:
- a[i][j] = 0
- continue
- moves = [a[i + 3][j], a[i * 2][j], a[i][j + 3], a[i][j * 2]]
- b[i][j] = 1 in moves
- if min(moves) <= 0:
- a[i][j] = 1 - max([x for x in moves if x <= 0])
- continue
- a[i][j] = -1 - max(moves)
- for s in range(1, 69 + 1):
- print(s, a[9][s], b[9][s])
Add Comment
Please, Sign In to add comment