You are viewing a single comment's thread. Return to all comments →
all you have to do is count the number of set bits, and the number of zeroes on the end less one.
def countergame(n): n = bin(n)[2:] n = n.split('1') turns = len(n)+len(n[-1])-2 return 'Louise' if turns&1 else 'Richard'
Seems like cookies are disabled on this browser, please enable them to open this website
Counter game
You are viewing a single comment's thread. Return to all comments →
all you have to do is count the number of set bits, and the number of zeroes on the end less one.