Share your repls and programming experiences

← Back to all posts
Unbeatable Tic Tac Toe
TrentBultsma (59)

To play, use the numpad to select your square and try to get 3 X's in a row. You will not win a game of tic tac toe against this AI. But if you do, please leave a comment with the moves you used so I can fix it. Here is a layout of the board if you don't have a num pad or are confused how that works:

7 | 8 | 9

4 | 5 | 6

1 | 2 | 3

launcherman08 (6)

Hey, nice job! Haven't been able to beat now!

MegaGiratina (1)

i beat it i simply put 5 then 6 then 1 then 2 then 3

TrentBultsma (59)


Are you sure because I lose when I do that

ShivrajNag (11)

@TrentBultsma Does this AI make same moves for a particular set of player's input???

Stanlyhalo (18)

Guys you do realize every time you comment a win with instructions, he will fix it so that won't work, right?

PowerCoder (2)

TrentBultsma made a more user friendly version of your game. The link to it is
Repl_Game_link_Click. You seem like you know what your doing in python. The remix includes colors, clearing the console . So that the console doesn't get crowded. It also tells you all the moves you did in order at the end of the game. You did waaaaaaay better than I could do in making a tic-tac-toe A.I game

ash15khng (234)

Now can we make this play itself?

Shinnie (0)

i won! just put 5, then 6, then 1, then 2, then 3!!!


Didn't loose but didn't win nice game

CharlieBolger (0)

its not unbeatable, i beat it first try

hhhggg (0)

This game is guaranteed to tie every time if every move is perfect

JuanCarlos32 (0)

Welp, the nearest solution to win is to tie

Axolotl1 (3)

It is unbeatable because it is an AI that doesn't get distracted.
Any game where both sides try will end in a tie

programmyBoi (14)

This AI is cool. I can't beat it, but I can definitely tie with it!

TrentBultsma (59)

@programmyBoi A perfect game of tic tac toe always ends in a tie

1Ethan (7)

Very nice, still haven't beat it yet. Must be doing something right...!

Unfortunately (12)

um the number input is really hard to understand

TrentBultsma (59)

@Unfortunately If you have a number pad on the side of your keyboard, the spots correspond to the numbers on that. If you don't, there is a helpful diagram in the description at the top.

TristinKeenan (0)

0 | X | X

X | X |

0 | 0 |
It did this then froze

TrentBultsma (59)

All wins below this post are fixed, continue bug testing. Your help is much appreciated

launcherman08 (6)

Same as me

Take the L, AI!

launcherman08 (6)

@launcherman08 Also, I did it on a chromebook!

UphillBrush (2)

I win! yay!

Me: 5 AI: 7
Me: 3 AI: 8
Me: 9 AI: 6
Me: 1 AI: 2
End of game

launcherman08 (6)

@UphillBrush Also won, check comment above on the page

TrentBultsma (59)

never mind, I figured it out and am working on a fix