The weekly puzzle from Le Monde is another Sudoku challenge:
Anahera and Wiremu play a game for T rounds. They successively pick a digit between 1 and 3, never repeating the previous one, and sum these digits. The last to play wins if the sum is a multiple of 3. Who is the winner for an optimal strategy?
By a simple dynamic programming of the optimal strategy at each step
N=3 A=matrix(-1,20,N) A[1,1:N]=1:N for (T in 2:20) for (i in 1:N) A[T,i]=i+ifelse(!T%%2, #parity check max((i+A[T-1,-i])%%3), #avoid zero min((i+A[T-1,-i])%%3)) #seek zero
the first to play can always win the game. Not fun!