Jake and I found ourselves watching New Girl and solving math puzzles last Friday. The. Good. Life.
Alice and Bob each pick the index that has the first 1 in their respective arrays.
For each permutation length, Alice and Bob nail one case where they necessarily win.
Bob’s array: 001011…
Alice’s array: 011100…
Bob’s guess: 3
Alice’s guess: 2
Note: In this case they do not win, as the second number in Bob’s array (0) is not equal to the third number in Alice’s array (1).
Python script simulation
import random #this creates the randomized bit arrays def makeBitString(bitlist, length): for i in range(0, length): bitlist.append(random.randint(0, 1)) #this is the guessing algorithm. The guess output is the index of your first 1 def guess(bitlist): index = 0 while (bitlist[index]!=1): index = index+1
Continue reading →