Untitled
unknown
python
3 years ago
505 B
6
Indexable
from functools import *
def moves(h):
vars = (h + 1), (h + 2), (h * 3)
return vars
@cache
def f(h):
if h >= 140:
return 'end'
if any(f(x) == 'end' for x in moves(h)):
return 'win1'
if all(f(x) == 'win1' for x in moves(h)):
return 'lose1'
if any(f(x) == 'lose1' for x in moves(h)):
return 'win2'
if all(f(x) == 'win1' or f(x) == 'win2' for x in moves(h)):
return 'lose2'
for i in range(1, 140):
print(i, f(i))Editor is loading...