I'm having problems finding an algorithm to the following problem:
A and B take turns replacing a number $n$ of tokens with either $floor((n+1)/2)$ or $n-1$. The player who makes one token remain wins. We want to know, if there is a way for B to win the game no matter the moves of A. A begins the game.
My idea is the following:
Is n = 1 -> No way for B to win the game
We try all moves of first A then B and check for 1 -> There is a way for B to win
But this does not incorporate the "no matter the moves of A" criteria.