This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
35

# First to 21 loses.

gantr833

In this game you will be playing against an AI. You can raise the counter by 1, 2, or 3. Then the AI will go. If the other person reaches 20, you basically lose.

4 years ago

### Voters

TopNew
4
EzekielJeske

Super simple. Anyone could do it. The "AI" just always adds whatever number brings the total up to a multiple of four, which makes it impossible to beat.

4 years ago
6
gantr833

@EzekielJeske
: That was the trick I used at school.

4 years ago
2
YeetMstr

HOW DO YOU WIN?!

4 years ago
4
PYer

@epicman702
It is impossible to beat

4 years ago
2
sthomason1

@epicman702
If you look closely, there's not even any code for the player winning

3 years ago
2
joshwood

You should let the AI go first sometimes... just to make it fair. ;)

Fun program!

4 years ago
3
gantr833

@joshwood
I am thinking of asking the user if they or the AI should go first. Thanks for the feedback!

4 years ago
2
themaka

Very nice! I remember playing this in school as a kid (I was a nerd).

4 years ago
1
georgina3

i know how you can't win when you type 1 al types 3 when you type 2 al types 2 when you type 3 al types 1

2 years ago
1
Myles123456

this is really good actually i just always lose it seems like

3 years ago
1
TuanNguyen8

My teacher teached me a trick to play this at my extra class when in was a kid. The objective is to hit n(the number that if u hit u will lose)-1 first. U have to go first if (n-1)/(k(the max value that u can add)+1)=m>0. Then u will add m. Else u have to let the opponent go first. Then on the other turns, the sum of your and your opponents point have to equal to m. But in this case (21-1)/(4+1)=0 so u have to let the bot go first but u cant do that because “0” is an invalid value so u cant win this.
But this is very good tho!!!
Good job.

4 years ago
3
Pythonier

@TuanNguyen8
Wow! that is really complex. I found another trick that works: I just added the a number that would make their and my number equal to 4.

4 years ago
1
davwheat

The amazing game of NIM.

4 years ago
1
Zavexeon

This game is evil.

Pure evil.

+1 though.

4 years ago