Advertisement
kirilchik

Untitled

Apr 11th, 2022
1,098
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. from functools import lru_cache
  2.  
  3.  
  4. def moves(s):
  5.     a, b = s[0], s[1]
  6.     return (a + 1, b), (a * 2, b), (a, b + 1), (a, b * 2)
  7.  
  8.  
  9. @lru_cache(None)
  10. def f(s):
  11.     if sum(s) >= 74:
  12.         return 'win'
  13.     if any(f(x) == 'win' for x in moves(s)):
  14.         return 'p1'
  15.     if all(f(x) == 'p1' for x in moves(s)):
  16.         return 'v1'
  17.     if any(f(x) == 'v1' for x in moves(s)):
  18.         return 'p2'
  19.     if all(f(x) == 'p2' or f(x) == 'p1' for x in moves(s)):
  20.         return 'v2'
  21.  
  22.  
  23. for i in range(1, 62):
  24.     print(i, f((12, i)))
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement