Share your repls and programming experiences

← Back to all posts
| \ | I | \ / |
Megamicah (24)

The age old game of Nim with an AI opponent who can never lose.

Commentshotnewtop
TobyS (15)

In other words, "whoever goes first loses"

MasonMyre2 (1)

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

HasanGandor (2)

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.

KevinPettibone (1)

I know how this works, it and you combined increase it by 4 every time

MarceloCarpenter (3)

i thought i could beat it...
:(