Share your repls and programming experiences

← Back to all posts
Tic-Tac-Toe
CyanCoding (2171)

https://repl.it/@CyanCoding/Tic-Tac-Toe

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

Comments
hotnewtop
RobertThompson4 (12)

If you do 7 then 8 then 9, you will win 95% of the time.

ebest (666)

code warningserrors sure can kill!

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

-Ebest

maxballard (8)

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 (2171)

@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.

EphrySanthosh (1)

I hacked the program by pressing x after telling it to play and telling the difficulty

YuAndy (75)

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

codingduck (8)


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

AmazingMech2418 (1045)


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

SilvermoonCat (434)

hmm I beat impossible in 3 moves, easier than normal mode

NathanPp (8)

i beat impossible in 5 moves pog

NathanPp (8)

nobody upvote or downvote this ever again

MeetaGupta (0)


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

FloCal35 (623)

I beat the impossible mode

FlaminHotValdez (610)

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 (14)

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

DavidLi17 (14)

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

[deleted]

cool game!

[deleted]

Nice job! Enjoyed playing.

Nanowrimoijk (60)

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

m_23s (0)

SHUT UP MAN WHAT U GONNA DO BRUV/ I FIND YOU

honchkrowabcd (6)

impossible isin't impossible

OwenBradstreet (125)

Proud :)
https://storage.googleapis.com/replit/images/1531403205473_8b0e31c28b54fa4243890294b258a9f3.pn

Spyder101 (7)

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

zacdisbury (0)

well well well that's cool

FiveCubed (15)

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

CyanCoding (2171)

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