•

Check out our Community Blogs

Register and join over 40,000 other developers!

### Recent Blog Entries

• phi

I love this community !

• JackJames

hi i am jack i am seo expert jack james would love you to read new post

# Need help with Tic-Tac-Toe variant

pascal tictactoce

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

### #1 MalekCHR

MalekCHR

CC Lurker

• Just Joined
• 2 posts

Posted 29 October 2014 - 10:36 AM

Hello,

I am trying to program a game a bit similar to tic tac toe on free pascal, the only difference is that in case of draw, each player can move one of his Xs or Os in order to have a straight line. The problem I am facing is that i didn't know how to make the movement possible and which test to do ?

### #2 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts

Posted 29 October 2014 - 11:24 AM

Can you clarify how that would work? I mean, the board would be filled, so I would envision this as a the game now comes down to alternating turns where each player swaps an X for an O (pick two spots with opposite X/O states, and reverse their states). Unfortunately, to be fair, the other player would need a chance to "correct" it so they get the win instead. What stops play?

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

### #3 MalekCHR

MalekCHR

CC Lurker

• Just Joined
• 2 posts

Posted 29 October 2014 - 12:30 PM

In fact each player have the right to place 3 Xs and 3 Os in total. After placing them all and in the case that none of the 2 players could have an alignment, there will be 3 places left, the first player will move one of his Xs in order to have an alignment and the second player as well. the winner is the first to have an alignement.

### #4 WingedPanther73

WingedPanther73

A spammer's worst nightmare

• Moderator
• 17757 posts

Posted 29 October 2014 - 01:33 PM

Okay, so each cell in your grid needs to have three states: empty, X, O. Once the first three moves are over, each player can select an empty and a spot of their type to swap states. The trick to a game like this is your model for the board and realizing that nothing "moves".

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download