Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 tic tac toe
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tony




PostPosted: Thu Aug 28, 2003 2:43 pm   Post subject: tic tac toe

this is one of my very first Visual Basic programs. It sucks since I didn't know VB all that well back then. Since then I've made some better versions of the game (once compsci grade below me got it as their final project assignment... *sigh*)


tic_tac_toe.zip
 Description:
VB tic tac toe

Download
 Filename:  tic_tac_toe.zip
 Filesize:  10.46 KB
 Downloaded:  1031 Time(s)

Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
the_short1




PostPosted: Sun Mar 28, 2004 5:17 pm   Post subject: (No subject)

bsic yet effective tic tac tow...... yes u must have been a real noob hen u made this,.., im sure u could do a lot better..... anyways... for its size(10 KB) that is AMAZING!!! i love VB because u can compile ur pictures into the program and stuff... tahts COOl!!!!! now i want to learn VB too... dam... so much do to over summer...
Pat




PostPosted: Thu Apr 06, 2006 10:14 am   Post subject: (No subject)

This was fun. The X's and O's are kind of skinny, and a little hard to see. Maybe colour and a bold font would help? I'm new to visual basic, so I don't know how to change the program yet. But good job!
Andy




PostPosted: Thu Apr 06, 2006 12:01 pm   Post subject: (No subject)

why do people not read the rules? when you reply to a topic that is almost three years old, that's called necroposting, and is against compsci.ca's policy...
tifg




PostPosted: Thu Dec 21, 2006 2:18 pm   Post subject: (No subject)

posting now wouldn't be more than 3 yrs old.. so here goes

how did u get the variables to remember its values across cmd boxes?

ie.
>>>>in the "new game" cmd box
turn = "p1"
>>>>in another cmd box tahts sopposed to display either X or O depending on the player order
if turn = "p1" then
cmd1.caption = "X"
else
cmd1.caption = "O"
end if

the trouble for me now is taht the turn variable gets cleared across the cmd boxes... so it would go to the else statement everytime...
idont kno if this matters anything but i changed the "private sub to public sub nd it didnt do netin...
Tony




PostPosted: Thu Dec 21, 2006 2:22 pm   Post subject: (No subject)

make sure your variables have the correct scope. Those decleared inside one function or subroutine will not be visible from another. You'd need something more... global.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
tifg




PostPosted: Thu Dec 21, 2006 2:36 pm   Post subject: (No subject)

Tony wrote:
make sure your variables have the correct scope. Those decleared inside one function or subroutine will not be visible from another. You'd need something more... global.


lol.. what EXACTLY do you mean by global? im listening
Tony




PostPosted: Thu Dec 21, 2006 4:26 pm   Post subject: (No subject)

I mean that something like player turn should be accessable by every function, so you would want to declear that at the very top of your source file, outside of any particular sub.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Thu Dec 21, 2006 4:36 pm   Post subject: (No subject)

or off course make a module Wink
tifg




PostPosted: Thu Dec 21, 2006 7:22 pm   Post subject: (No subject)

alright... this wut i got so far, been workin on it for abt 40 mins... a TON of copy nd pasting..
but theres a couple major problems tho i don kno hwo to fix...
its very easy to find the problem so ill jux post this thing nd see if you guys can help me out...



tic tac toe.frm
 Description:

Download
 Filename:  tic tac toe.frm
 Filesize:  10.28 KB
 Downloaded:  455 Time(s)

Tony




PostPosted: Thu Dec 21, 2006 8:12 pm   Post subject: (No subject)

well don't look at me, I haven't been coding VB since... *looks at his original post* 2003 it appears. Heck, I don't even have Windows anymore, score!
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
cool dude




PostPosted: Thu Dec 21, 2006 8:18 pm   Post subject: (No subject)

copy and paste is bad because you won't understand a lot of the code your writing. anyhow u have quite a bit of problems starting with u can double click on the same button and it will switch from X to O. to fix this you can disable the button. but i'll make your life much much easier by telling you to use control arrays. basically make one button name it something than copy and paste all your other buttons. this will be much easier and a lot more efficient. if you don't take my advice and continue your going to get really screwed up and it will take you hundreds of lines of code to make when you can make it under 50 lines
cool dude




PostPosted: Thu Dec 21, 2006 8:44 pm   Post subject: (No subject)

Here i started you off on the control array.


tictactoe.frm
 Description:

Download
 Filename:  tictactoe.frm
 Filesize:  3.17 KB
 Downloaded:  472 Time(s)

Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 13 Posts ]
Jump to:   


Style:  
Search: