Tic Tac Toe (now with versus ai mode!!)
CodingCactus (2433)

The classic game of Tic Tac Toe

2 Modes:

  • CPU; play against computer (now with three difficulty settings)
    • Easy
    • Hard
    • Impossible
      • If you manage to beat impossible mode please comment with
        proof and how you did it.
  • 2 Player; play with friends

Aim of the game:

  • Get 3 of your symbols in a row

How to play:

  • Enter coordinate of place that you would like put your symbol (1,1 (column, row))

Thanks to:

But mainly extremely large thanks to @Coder100 for explaining them!!

Have fun and if you do: make sure to upvote! :)

edit: Now has colours :)

edit 2: Now has difficulty levels :)

Edit 3: Now has Impossible difficulty level :)

You are viewing a single comment. View All
AmazingMech2418 (655)

The CPU in impossible mode knows every known Tic-Tac-Toe strategy there is! It's like I'm playing against myself! LOL! How do you not tie with the impossible mode CPU? Wait, what is this? It seems like a screenshot I just took which says I beat the impossible mode CPU...

On a completely unrelated note, don't look at my repl titled "test"

AmazingMech2418 (655)

LOL! I tried command injection, but you sanitized your inputs. ... so I did something else...

AmazingMech2418 (655)

A better screenshot that shows the whole screen:

AmazingMech2418 (655)

I would go ahead and say how I did it, but I kind of what to see how you react when you see the screenshot... However, the screenshot itself should have a huge giveaway...

CodingCactus (2433)

@AmazingMech2418 you have hacker, so just make test private (I didn't look)

What did you do? Did you cheat or was it legit?

AmazingMech2418 (655)

@CodingCactus I kind of stopped the program, opened a terminal using os.system('bash'), created a simple express server to host an alternate version of your python program, replaced all "Easy Mode" instances with "Impossible Mode", and used the curl command and piped the result into main.py. I then started it and selected 1 for easy mode, beat the CPU in easy mode, and then it said "Impossible Mode" at the top and took a screenshot...

"test" is the simple server by the way...

AmazingMech2418 (655)

@CodingCactus Well, any other way to edit it would create a fork and then the screenshot wouldn't show it as your repl...

CodingCactus (2433)

@AmazingMech2418 it's called impossible mode for a reason

AmazingMech2418 (655)

@CodingCactus Yeah. I know, but it is possible if you just replace the Python code with an alternate version using the curl command in bash... However, to win without hacking, it is actually impossible because it knows every strategy for Tic-Tac-Toe that there is.

AmazingMech2418 (655)

@CodingCactus Though do you like my method of winning? I technically beat the CPU, but just in a different mode than what it displayed.

CodingCactus (2433)

@AmazingMech2418 well, anyone can beat easy mode soooo...

AmazingMech2418 (655)

@CodingCactus Yeah... Though hard mode is also fairly easy to beat, but I was trying to go somewhat quick and it seems to have some randomized features that caused a tie instead...

CodingCactus (2433)

@AmazingMech2418 yea, on hard mode it doesn't detect one of the win methods so it is easier to beat with that method, if it doesn't detect anything then it just goes in a random place, easy mode is just looking to stop lines which already have 2 in, so doesn't think ahead

AmazingMech2418 (655)

@CodingCactus You're welcome! I actually tried every single strategy I know in impossible mode before hacking it though... Great job on your AI! I use the same defensive methods as your AI uses in real games of Tic-Tac-Toe and since figuring out all of the Tic-Tac-Toe strategies, I have never lost unless I was tired and accidentally ignored the other player's move, so I actually think this AI is impossible to beat.