Computer Science Canada Tic Tac Toe help!!! |
Author: | Scrubtastic [ Thu Dec 15, 2011 10:10 am ] | ||
Post subject: | Tic Tac Toe help!!! | ||
What is it you are trying to achieve? Making a tic tac toe game in turing for my isu What is the problem you are having? i can get the game to work but every time i click with my mouse on a box nothing appears, and the turns changes Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) Here is my code
Please specify what version of Turing you are using i'm using turing 4.1.1 |
Author: | Velocity [ Thu Dec 15, 2011 10:14 am ] |
Post subject: | RE:Tic Tac Toe help!!! |
var tic : int := (mousewhere, (x, y pos)) var tac : int := (mousewhere, (x, y pos)) so when they click it it appears and stays there, look into a tutorial for mouse down. |
Author: | Scrubtastic [ Thu Dec 15, 2011 4:48 pm ] |
Post subject: | RE:Tic Tac Toe help!!! |
it works but i need to change the score but keep the Xs and Os where they are i don't understand how to do that |
Author: | Linkxgl [ Thu Dec 15, 2011 7:30 pm ] | ||||
Post subject: | RE:Tic Tac Toe help!!! | ||||
You're very close. There are two ways to do this. Using an array to keep which spaces on the board are occupied and each time it runs through the loop and clears the screen, you load up the occupied spaces and the score... OR, the easier way, delete lines manually without deleting the board. This is the way I dealt with the problems... First, I added a cls right before you start the game. Here:
Then I went into the loop and made sure that your score board and the names where pasted in the same place, you made it easy, and it's in the position 1,1 on the Turing screen. I use the locate function, and re-wrote the information on top of the scoreboard and names... So it looks like this:
And that's it... Not sure how you plan to keep score because no one wins yet... haha, but it should let the Xs and Os stay now! If you are planning to win, however, you'll need to make an array which keeps the placements of the Xs and Os, and then when the Xs or Os line up, you can tell who won! |
Author: | Scrubtastic [ Fri Dec 16, 2011 10:39 am ] |
Post subject: | Re: Tic Tac Toe help!!! |
Okay so how do i determine if a person won or is it a tie? i know we have to use an array to keep track of the spots but i don't know how to do it? |
Author: | Aange10 [ Fri Dec 16, 2011 3:34 pm ] |
Post subject: | RE:Tic Tac Toe help!!! |
Try looking at http://compsci.ca/v3/viewtopic.php?p=249837#249837 to see how using an array works and how flags work. Instead of toggling on or off, toggle it X/O/Empty. How do you determine if a person wins or its a tie? ... It's tic-tac-toe... |