Sign in to follow this  
patishi

Tic tac toe on 5x5 board

Recommended Posts

Hi all.   I started my journey into AI board games with a simple tic tac toe (alphaBeta) implementation in java,and than i continued to the more challenging connect 4 game also in java.   The latter obviously demanded much more time and learning , and my knowledge is a lot more because of that (and thanks to a lot of help from certain forum's members).      
Now i am starting to learn some objective-C (and as a consequence some c) and i wanted to practice the language syntax with another little and not too difficult to program board game (chess was originally my next step,but it will have to wait for later).     I so what can be more easy to implement than a tic tac toe game, but this time, in order for it to be a little more challenging and less boring, i though of making a 5x5 board tic t ac toe.   

but i have some questions:   
1.  is it best to play for 4 in a row in 5x5 board?  or maybe  5 in a row?   ( or stay with the default 3? )

 

2.  second,  do you think that in case of 5x5 board it would be possible to have perfect alpha beta (full game search)  in short time ,   i did it this way in the normal TTT 3x3 board, pure alpha beta without transposition tables,heuristic evaluations functions...nothing!    but i wander if this can be done in a bigger 5x5 board.  
 

Any more advices and insites are welcome  :)   thx!

Share this post


Link to post
Share on other sites
What does tic-tac-toe on a 5x5 board mean? It doesn't look like you know. Designing interesting board games is not a trivial task, so I suggest you pick some well-known game instead of making your own.

If chess is what you want to work on (and given that you have done some work on connect-4 already), go work on chess. The Chess Programming Wiki has a lot of useful info to get you started and then entertained for a few years.

Share this post


Link to post
Share on other sites

Chess is to complicated right now and i still needs much more practice in coding in c/objective C.    so far i have practiced in some basic coding exercises (mainly from Cprogramming  site),   but i want to do something a little more complicated than that the requires creating classes and more complex structures and functions.    but i don't want it to be too complicated so i will be able to concentrate mainly on learning the language.    

5x5  tic tac toe is just a normal tic tac toe on a 5x5 board (same rules).  this is not my invention,i heard about it from other sources, although it is not that common.       I can maybe try to do checkers, but i think that it is getting to be too complicated for me right now.
I just wasn't sure if 5x5 board tic tac toe will be the same as a normal tic tac toe in the sense that it will not add nothing to the complexity of the game, and in that case there is no point in me doing this.   otherwise i would just make a regular tic tac toe and get over with this...

again,this is mainly for practicing the language.  I  know that tic tac toe will not challange me too much at this point,but it could be a nice language practice.

Share this post


Link to post
Share on other sites

Tic Tac Toe wouldn't work properly as a 3 in a row on a 5x5 grid.

The first will always win if they place a piece in the center or the middle ring.

No matter where the second person goes the first person will be able to place a piece on the center/middle ring, the second person has two options to block, and the first person wins on the third go.

A 4 in a row on a 5x5 grid may be a little harder but the first person will always be in the lead as the second person will have to block every single turn instead of trying to score a 4 in a row.

 

5 in a row, will end in more stalemates as there are more places for each other to block and only 12 ways to win.

Share this post


Link to post
Share on other sites

Thanks for the comment.  I guess there is not substitute for the original 4 in a row (connect 4) smile.png   So i guess it is not the best idea after all      well,  maybe i will just go with checkers or something...     Although i would really love to work on a chess engine of my own someday,  right now i just want to do something not to difficult just to learn the c/objective C language.    
maybe checkers will do fine for a little learning project.    it seems to me like not too hard to implement game,or am i wrong...

I also thought about gomoku (a 13x13 five in a row)  but i realized that it can be much more trickier than i think

Edited by patishi

Share this post


Link to post
Share on other sites
I think writing your first chess program is easier than writing your first checkers program. You can start with a version of chess with no castling and no en-passant rule, which simplifies things quite a bit.

Another easy game to program is Mancala.

Share this post


Link to post
Share on other sites

In my country nobody plays the boring 3x3 tic-tac-toe, we know this version only from american movies. We play on "unlimited" board and the goal is to connect 5 symbols. That's quite hard and perfectly playable version.

Of course the board is not unlimited, but it's always larger than 5x5 of course. It can be anything, based on the squared paper that the players actually have available smile.png

On a computer, you even can make it unlimited, because the game never really takes too much place, so you can extend the borders in the code as needed. But if the board is limited, it serves also for gameplay purposes, the player has to count with the fact that he may not be able to connect 5 if he gets too close to the border.

 

Btw, I've done a simple (but working) AI for this game. It was just about traversing all squares and computing "offensive" and "defensive" numbers for each of them, then summing them and playing the square with the highest score.

Offensive is where you would make a longer line, defensive is where you would block the enemy's line. If a square can belong to more lines, then the scores are added together of course.

 

Situations like 4 symbols in a line with empty space on one side have a special bonus score, because you simply must play there (either to win or to block the enemy's winning move).

 

Or course this AI thinks only about the 1 following move, it cannot intentionally create something really clever, like some kind of trap.

Edited by Tom KQT

Share this post


Link to post
Share on other sites

In my country nobody plays the boring 3x3 tic-tac-toe, we know this version only from american movies. We play on "unlimited" board and the goal is to connect 5 symbols. That's quite hard and perfectly playable version.

In my country we don't play the boring 3x3 tic-tac-toe either. We play on an 8x8 board with 8 pawns, 2 rooks, 2 knights, 2 bishops, a queen and a king per side, and instead of connecting 3 symbols the goal is to give checkmate.

Share this post


Link to post
Share on other sites

 

In my country nobody plays the boring 3x3 tic-tac-toe, we know this version only from american movies. We play on "unlimited" board and the goal is to connect 5 symbols. That's quite hard and perfectly playable version.

In my country we don't play the boring 3x3 tic-tac-toe either. We play on an 8x8 board with 8 pawns, 2 rooks, 2 knights, 2 bishops, a queen and a king per side, and instead of connecting 3 symbols the goal is to give checkmate.

 

But that's a completely different game.

And to play tic-tac-toe you need just one (or two) pens and a paper (preferably squared, but you can draw squares in a minute). You can play it on a train, bus, at school during the break or even during boring classes under the desk smile.png

To play chess you need much more and also much more time.

So sorry, but you cannot compare it.

Edited by Tom KQT

Share this post


Link to post
Share on other sites

You didn't know that sarcasm doesn't work on internet forums? It's quite impossible to detect it, usually. wink.png

 

Ouch, I didn't know the game was originally called Gomoku. Thanks for that. (no sarcasm smile.png )

Edited by Tom KQT

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this