Share your repls and programming experiences

← Back to all posts
CyanCoding (1838)

As a fun side project, I built this awesome Tic-Tac-Toe game (with three AI levels) in May 2017.

ebest (644)

code warningserrors sure can kill!

and HOW did this get the 5th most votes in ALL the posts!?!?!?


maxballard (5)

It works and all, but no tic tac toe program like this should be 2000 lines long. You can put a lot of the stuff you have into specific functions. You repeat yourself many times, and basically just hardcoded the game. This will work for a simple game like tic tac toe, but if you wanna progress farther as a programmer you need to actually learn how to program.

CyanCoding (1838)

@maxballard Haha, thanks for the tip. Do note though that I made this over a year and a half ago, and it's not even in the same language I use now. But yes, I have gotten over that bad habit.

YuAndy (56)

I beat the impossible level in 4 moves!!!!!!

DavidLi17 (16)

@YuAndy I did it in 3 moves!!!!!!!!!!!!!!!!!!!!

codingduck (8)

ummmmmm wut:| also scroll bar all that...

AmazingMech2418 (941)

Impossible mode seems to have lost its right for its name... It was actually very easy to beat...

MeetaGupta (0)

The impossible level can be beaten in three moves!!! can make It better.

FloCal35 (174)

I beat the impossible mode

maxyang (138)

I was a bit surprised when a tic tac toe program took 2600+ lines of code, no tic tac toe should be that long. Also it generated 646 lines of code, and "Impossible" isn't really impossible(It's beatable in 3 moves)

DavidLi17 (16)

I beat the impossible level in 3 moves!!!!!!

DavidLi17 (16)

I beat the impossible level in 3 moves!
and beat it on first try!


cool game!


Nice job! Enjoyed playing.

Nanowrimoijk (42)

beat impossible, thats what comes when you play against yourself =(

m_23s (0)


honchkrowabcd (6)

impossible isin't impossible

Spyder101 (4)

Holy cow great job! The code works smooth and he difficulties hold up their reputation...

zacdisbury (0)

well well well that's cool

FiveCubed (14)

Why do you have it look at every spot on the board to test for a win?

CyanCoding (1838)

@fivecubed: This way it can make sure you won, regardless of the win spots.

Jeremiah32556 (0)

This is REALLY cool. I think it would be better if it was more obvious where the player "0" plays because I sometimes can't tell if the bot played in a spot or if it's just the number zero.

glendog (0)

2600+ lines of code :o

RyanBridgforth (0)

@glendog: Just wait until his next project...

AntonAlley (0)

I'm building a tic tac toe AI in PYTHON only 300 lines for the whole game and AI

CyanCoding (1838)

@antonalley: Awesome! Yes, after writing this in C++ I realized my mistake 😀. Can you send me a link please?

s622420 (0)

it would be nice if there was a play again button

CyanCoding (1838)

@s622420: I think that's just the run button 😀

BobJoeIII (19)

I beat impossible mode!!!!!!! (my life is complete)

beginneer (0)

yo code is just insane! KEEP IT UP

J7Luke (0)

Nice simulator! I can always win against impossible if I go first, and I can always tie if I go second.

CyanCoding (1838)

@j7luke: That's a sign of a real pro! As far as I've seen from other users, there's only one-two ways to beat impossible!

TuffeMann (0)

Hi Cyan. That computer is quite polite. It won, with three o-s in a row, but let me place anothr x after winning. So I also got 3 in a row. The computer then told me that I had won the game. REALLY! There must be a bug in this game somewhere...

CyanCoding (1838)

@tuffemann: Yes, I don't know where that bug is, but I've seen it happen before. I just thought it too funny to remove 😄