Share your repls and programming experiences

← Back to all posts
25
| \ | I | \ / |

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

Loading Repl
Commentshotnewtop
5

In other words, "whoever goes first loses"

2

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

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.

1
1

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

1

i thought i could beat it...
:(