4 Replies - 464 Views - Last Post: 17 January 2013 - 07:23 AM Rate Topic: -----

#1 bboyzeez  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 143
  • Joined: 16-December 12

am i going along the right track? tic tac toe

Posted 16 January 2013 - 04:44 PM

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

Is This A Good Question/Topic? 0
  • +

Replies To: am i going along the right track? tic tac toe

#2 b0zhidar  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 24
  • Joined: 21-December 12

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.
Was This Post Helpful? 0
  • +
  • -

#3 bboyzeez  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 143
  • Joined: 16-December 12

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
Was This Post Helpful? 0
  • +
  • -

#4 b0zhidar  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 24
  • Joined: 21-December 12

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
Was This Post Helpful? 0
  • +
  • -

#5 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5481
  • View blog
  • Posts: 11,762
  • Joined: 02-June 10

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1