The age old game of Nim with an AI opponent who can never lose.
At first, I saw the code and thought that you were confident when you had it to always say "I win", now I know why
Whatever you pick, the bot will add whatever makes the numbers sum to 4. That way it goes to 4, 8, and then 12 and the bot wins.
Or just imagine the game goes up to 4 to win. It becomes much clearer. Just stretch that out to 8 and then 12.