Tic-Tac-Toe
CyanCoding (1417)

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.

You are viewing a single comment. View All
replitFan (0)

This is so much fun! I'm determined to beat Impossible mode!

CyanCoding (1417)

@replitfan: Thanks! Good luck on that by the way, I believe I created an algorithm that will only let you tie/lose when facing it.

ChrisJantzen (2)

@microwither: I actually beat it when I went first. I went 4, it went 5, I went 8, it went 6, I went 7 which means I had 2 win conditions. So just gotta add a check for a move like that (:

CyanCoding (1417)

@chrisjantzen: Great job! As far as I know, you're the first!

will_johnson (0)

@microwither: Yeah, I went 2, it went 5, I went 7 (looking for 1, 8 or 3 if it makes a mistake), it went 4, I went 6, (Best move for computer here would be 3 to block the double) but it went 8, then I went 3 and had 2 win conditions. However, if you go to https://ostermiller.org/calc/tictactoe.html, your impossible is more like experienced, which I think is really nice, because you can still beat it, but its hard (kinda, unless you know what you're doing).

CyanCoding (1417)

@willjohnson: Awesome! I'm a bit rusty with this program since I coded it in May 2017, but I'll try to fix this.

CyanCoding (1417)

@willjohnson @chrisjantzen I believe that this has been fixed! Good luck beating impossible now!

5005 (0)

@microwither: managed to beat it on impossible went 7 it went 5 then i went 3 it went 1 and i went 9 putting myself in a guaranteed win

CyanCoding (1417)

@5005: Good catch! Unfortunately, in that instance, it actually isn't possible for the computer to win anyway. It would need two moves since you could do that in two places. Good job!

ChrisJantzen (2)

@microwither: You could potentially not make the ai's default move be in the middle to counter that I guess.

edit: someone below explained it so nevermind lol

ntachev (0)

@microwither: I went 1, it went 5, i went 9, it went 3, i went 7, it went 4, i went 8 and won first try on impossible. There is no algorithm that guarantees a victory in this game, that's what makes it so fun. If you wanna see why write out all of the possibilities, it really helps you understand the game. And then you can rewrite your algorithm to make it harder, still not impossible, but harder.

ubaid_raf (0)

@microwither: for @5005 's method of beating the impossible difficulty instead u could counter the move by placing in 2 or 4 or 6 or 7 position thus blocking the 2 winning moves by the player forcing a tie.

n113 (8)

@replitfan: it impossible. Ive built one too and it is impossible....

JosephLooney (0)

@replitfan: I was able to beat it by choosing opposite corners and then filling in the one spot that the computer didn't choose to block me in.