Share your repls and programming experiences

← Back to all posts
23
🤖 5x5 Tic Tac Toe Bot - Taking 3x3 to the next level!

Play a game of 5x5 Tic Tac Toe against a very hard bot! A true challenge compared to 3x3.

Introduction

We are all used to playing 3x3 tic tac toe. A relatively easy game to tie, and a bit harder to pull off a win. This bot takes it to the next level!

You can now play 5x5 tic tac toe against a very good ai. This is a true challenge to win. If you win, comment below (you deserve a cookie).

How the AI Works

The Ai follows a set process:

1) Check if there is a space where either player can go to win immediately.
If so, go there. You are either blocking the enemy or winning the game.

2) Check if you can make a fork. That is a move that opens up multiple groups of five empty spaces. With forks, you will be able to attempt to win in different directions.

3) Play an open corner (4 spaces)

4) Play an open center space (9 spaces)

5) Play an empty side space (12 spaces)

Commentshotnewtop
3

A suggestion, you might want to put the number of the boxes in the box so you don't have to count which box is which. Otherwise it is pretty good!

1

@IEATPYTHON Thanks for the suggestion.

2

Thats actually pretty cool, good job!

1

@Grify Thanks. I loved tic tac toe, and I wanted to make it a real challenge.

1

Nice game! I really like playing it. I think that you should put numbers in the boxes to signify which box is which number. Also, I drawed against the ai.

1

For input greater than 24 program is crashing..better to add a try n catch
BTW very nice :)