Jump to content
  • Advertisement
Sign in to follow this  

[C++] Checking if round was a Tie...need help [RESOLVED]

This topic is 4414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello to whoever reads this, :) Im creating a text TicTacToe Game. Im at the point where I check whether 3 In-a-Row has been made or if the round ended up being a Tie. I've got the checking for 3-I-A-R done and it works. Im having problems with finding if the round was a Tie. My problem is, I don't know where to start...how to start. My game board is a multi-dimensional array. I check the 3IAR part with a lot of if statements like this: if(game_board[0][0] == 'X' && game_board[0][1] == 'X' && game_board[0][2] == 'X' { player2_wins = true; } etc..... Thing is, I don't think I can do this for checking if there is a Tie. If anyone has any suggestions on how I would go about checking for a Tie, I would really appriciate a respone. Thank you. [Edited by - Koolchamp on May 19, 2006 3:54:07 PM]

Share this post

Link to post
Share on other sites
Well when you check for a win, you need to check whether any of the corresponding positions are equal:


If any of those triplets are the same piece then you have a winner. Otherwise it is a tie.

To code it, i would iterate through an array that stores these 8 lots of 3 numbers in chunks of 3.

Hope that helps,


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!