Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import lru_cache
- def moves(s):
- a, b = s[0], s[1]
- return (a + 1, b), (a * 2, b), (a, b + 1), (a, b * 2)
- @lru_cache(None)
- def f(s):
- if sum(s) >= 74:
- return 'win'
- if any(f(x) == 'win' for x in moves(s)):
- return 'p1'
- if all(f(x) == 'p1' for x in moves(s)):
- return 'v1'
- if any(f(x) == 'v1' for x in moves(s)):
- return 'p2'
- if all(f(x) == 'p2' or f(x) == 'p1' for x in moves(s)):
- return 'v2'
- for i in range(1, 62):
- print(i, f((12, i)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement