hi all , my challenge is to create a simple tic tac toe , now i have written the code so when you click a square it draws a string into that square but i everytime i click another square the previous dissapears and the newly clicked square gets drawn...
1. i know future modifications will be to stop a square being rewrote once its become drawn.
2. is there anyway of making a string invisible and visible?
i am thinking maybe, when the user(or comp) clicks an empty square i am orignally changing a variable index to match which square was click in order to draw in the X or O , but if i was to have a variable(array) so all boxes are 0 and when its been clicked it becomes a 1 , i could use this to stop a "occupied" square being changed?
as far as my problem with the X and O keep dissapearing i am guessing this is because everytime i invalidates it OnPaint which recreates everything. would this be fixed by creating a eventhandler called newgame for example which draws the game in and then have a seperate void method which adds in the pieces so its all out of OnPaint therefore not keep renewing?
i am not home to send code or try this is just my thoughts at beginning of a 9 hour shift at work so would like to know if im on right track so i know when i get home if ill be wasting my time trying this thanks
am i going along the right track? tic tac toe
Page 1 of 14 Replies - 144 Views - Last Post: 17 January 2013 - 07:23 AM
Replies To: am i going along the right track? tic tac toe
#2
Re: am i going along the right track? tic tac toe
Posted 16 January 2013 - 11:23 PM
Did you thought about making the font bigger and simply write O and X as letters when it's clicked?
That would be much easier and you would done it without much hassle.
That would be much easier and you would done it without much hassle.
#3
Re: am i going along the right track? tic tac toe
Posted 17 January 2013 - 12:22 AM
I managed to get on my laptop
ye I got the font size as a ratio to the screen which works now
only thing I'm stuck on is the drawing the string onto the square and keeping it there. I know from what the chapter just taught me is to do with translating a region so I was thinking maybe fillregions in but off screen then when player clicks square have it translate in? I know it's a Mickey Mouse job but once I learn the appropriate things that I know I'm missing I will continue to modify the game until I am happy with it
#4
Re: am i going along the right track? tic tac toe
Posted 17 January 2013 - 12:40 AM
You don't get me. Anyway, RexGrammer made a tutorial about Tic Tac Toe.
You can find it here:
http://www.dreaminco...__fromsearch__1
You can find it here:
http://www.dreaminco...__fromsearch__1
#5
Re: am i going along the right track? tic tac toe
Posted 17 January 2013 - 07:23 AM
There are at least 100 threads on Tic Tac Toe homework here on DIC.
Every student has it. I would recommend you read a few of them to get ideas for directions you may never have thought of. But as this is homework we can't give you code.
Every student has it. I would recommend you read a few of them to get ideas for directions you may never have thought of. But as this is homework we can't give you code.
Page 1 of 1
|
|

New Topic/Question
This topic is locked



MultiQuote




|