Skip to content

Instantly share code, notes, and snippets.

@mmasztalerczuk
Created November 1, 2016 20:53
Show Gist options
  • Save mmasztalerczuk/c7bfd473245c5d87174322d653c14de3 to your computer and use it in GitHub Desktop.
Save mmasztalerczuk/c7bfd473245c5d87174322d653c14de3 to your computer and use it in GitHub Desktop.
def count(a):
return len(bin(a)[2:].replace("0", ""))
class ThueMorseGame:
def get(self, n, m):
last = 0
i = 0
while i <= n:
if count(i)%2 == 1:
i += 1
else:
last = i
i += m + 1
return "Bob" if last == n else "Alice"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment