Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 16th, 2005, 9:55 AM   #1
JDS
Newbie
 
Join Date: Nov 2005
Posts: 1
Rep Power: 0 JDS is on a distinguished road
Please help, need within next half hour

I'm programming a VB tic tac toe game. for the board I have 9 image controls
named tictactoe(Index). and two picture controls (one X one O) called Sign(0), and Sign(1) (0 is X). I drag and drop the Sign controls onto the tictactoe one and everything works fine. What I need help on is determining the winner of the game. Right now all I know is how to:

For Index = 0 to 2
if tictactoe(Index).picture = Sign(0).picture Then
Winner = "X"
cmdnew_click
end if
Next

Naturally though using this code whenever I put down an X on the top row, it immediatly says X is the winner and ends the game. How do I make it so the ENTIRE top row has to be X before this code executes?

Thx

Last edited by JDS; Nov 16th, 2005 at 10:20 AM.
JDS is offline   Reply With Quote
Old Nov 19th, 2005, 10:32 AM   #2
Kilo
Expert Programmer
 
Kilo's Avatar
 
Join Date: Nov 2005
Location: In Pink Clam?
Posts: 542
Rep Power: 0 Kilo is an unknown quantity at this point
Send a message via AIM to Kilo
Quote:
Originally Posted by JDS
I'm programming a VB tic tac toe game. for the board I have 9 image controls
named tictactoe(Index). and two picture controls (one X one O) called Sign(0), and Sign(1) (0 is X). I drag and drop the Sign controls onto the tictactoe one and everything works fine. What I need help on is determining the winner of the game. Right now all I know is how to:

For Index = 0 to 2
if tictactoe(Index).picture = Sign(0).picture Then
Winner = "X"
cmdnew_click
end if
Next

Naturally though using this code whenever I put down an X on the top row, it immediatly says X is the winner and ends the game. How do I make it so the ENTIRE top row has to be X before this code executes?

Thx

Post the code you have so far... but it sounds like it you main game loop you need to add a "CheckRows" function call after player turn...
__________________
"When in Rome, Do as the Romans Do"
"Beauty is in the eye of the BEER holder"
"Save your breath your going to need it for your blow up doll later"

SearchLores.org
Kilo is offline   Reply With Quote
Old Nov 19th, 2005, 10:47 AM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
Please help, need within next half hour
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 20th, 2005, 3:10 PM   #4
13EN
Newbie
 
13EN's Avatar
 
Join Date: Nov 2005
Posts: 13
Rep Power: 0 13EN is on a distinguished road
hi please can you send me that tictactoe game on ben@inbox.karoo.co.uk please
13EN is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:31 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC