Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 04-21-2006, 09:58 AM   #1
Fully Optimized
 
Paradox's Avatar
 
Join Date: Aug 2005
Posts: 2,913
Send a message via AIM to Paradox Send a message via MSN to Paradox Send a message via Yahoo to Paradox
Default Programming Question that has me stumped

I am currently making a simple (or so it seemed before I began) Tic Tac Toe Program because we have no more assignments anymore lol My teacher ran out of curriculum for us

Anyways, I have it set up, you can play a game, if you get three in a row you win and all, but the only thing is... you can overwrite the other players selection. (P1 picks top left, top left becomes X; P2 then picks top left, top left becomes O)





My idea is set the variables unchangable after a certain number of changes, in this case 1 change (until a given situation resetting it{the end of the game})


I'll take any advice I can get to make it work, I've been doing this for fun for some time prety much out of boredom, If you have an idea different from mine I'd like to hear it.
__________________

__________________
ROW ROW FIGHT THE POWAH

Xbox Live: Error Lord
Personal Email: HunterMRose[at]gmail.com
Aim: Error Lord
Paradox is offline   Reply With Quote
Old 04-21-2006, 11:42 AM   #2
Daemon Poster
 
Lac3y's Avatar
 
Join Date: Oct 2005
Posts: 1,110
Send a message via MSN to Lac3y
Default Re: Programming Question that has me stumped

wow, it's been really long since I've done any programming. I've forgot everything! lol

Out of curiousity, what language are you using? I've only ever had experience with PASCAL.
__________________

__________________
Intel Core 2 Duo E8400 @ 3.7GHz
4GB OCZ PC-6400 RAM
Samsung Spinpoint 1TB HDD
ATI Radeon HD4890 with VoltageTweak
OCZ Stealth XStream 600w PSU
Lac3y is offline   Reply With Quote
Old 04-21-2006, 11:44 AM   #3
Golden Master
 
joxley1990's Avatar
 
Join Date: Oct 2005
Posts: 7,846
Send a message via AIM to joxley1990 Send a message via MSN to joxley1990
Default Re: Programming Question that has me stumped

Yeah, what you using? C++?
joxley1990 is offline   Reply With Quote
Old 04-21-2006, 03:49 PM   #4
Baseband Member
 
Join Date: Feb 2006
Posts: 46
Default Re: Programming Question that has me stumped

keep an array:

gameinfo(0 to 2, 0 to 2, 0 to 1) as long

gameinfo(x,y,0) = (x,y) location used ( boolean [ 1 | 0 ] )
gameinfo(x,y,1) = (x,y) player mark, if gameinfo(x,y,0) is set

thats what it would look like ( somewhat - the part of that says what the array element is equal to is not really code ) in vb6
__________________
Foxconn 6150BK8MC-KRSH
939x2@4200+
4GiB OCZ DDR400@2.5|3|2|5
BFB 7800GTX 256MiB
Antec EarthWatts 650W
lemon is offline   Reply With Quote
Old 04-21-2006, 11:50 PM   #5
Fully Optimized
 
Paradox's Avatar
 
Join Date: Aug 2005
Posts: 2,913
Send a message via AIM to Paradox Send a message via MSN to Paradox Send a message via Yahoo to Paradox
Default Re: Programming Question that has me stumped

Could have sworn I said what language it was in =\ oh well, thanks for the replies, It's in C++ .NET
__________________
ROW ROW FIGHT THE POWAH

Xbox Live: Error Lord
Personal Email: HunterMRose[at]gmail.com
Aim: Error Lord
Paradox is offline   Reply With Quote
Old 04-27-2006, 10:08 AM   #6
Fully Optimized
 
Paradox's Avatar
 
Join Date: Aug 2005
Posts: 2,913
Send a message via AIM to Paradox Send a message via MSN to Paradox Send a message via Yahoo to Paradox
Default Re: Programming Question that has me stumped

Sorry for double post, But I really need an answer for this thing =\

I dont see how an array could help anything. What I want to do is basically make a temporary constant (after topleft is initialized to X it becomes constant until a given action (end of the game, reseting it to " ")

but i dont know how to say that in code
__________________
ROW ROW FIGHT THE POWAH

Xbox Live: Error Lord
Personal Email: HunterMRose[at]gmail.com
Aim: Error Lord
Paradox is offline   Reply With Quote
Old 04-28-2006, 04:29 PM   #7
Daemon Poster
 
RewtGuy's Avatar
 
Join Date: Dec 2004
Posts: 595
Send a message via AIM to RewtGuy
Default Re: Programming Question that has me stumped

source code?
__________________
Windows: A thirty-two bit extension and GUI shell to a sixteen bit patch to an eight bit operating system originally coded for a four bit microprocessor and sold by a two-bit company that can't stand one bit of competition.
RewtGuy is offline   Reply With Quote
Old 04-29-2006, 04:42 PM   #8
In Runtime
 
Renegadeandy's Avatar
 
Join Date: Apr 2006
Posts: 291
Send a message via MSN to Renegadeandy
Default Re: Programming Question that has me stumped

Ok, what i would do is set a flag on each of the 9 squares, say, square 1 = 0 , square 2 = 0 etc all the way to 9, then when a square is clicked, set the flag of that square to 1.

Now, before you can click on a square, put all the clicking code which puts a x down under an if statement saying - if square 1 = 0 then (do the click) otherwise do nothing, as its already got something it?!
__________________
Referred to by : UK31337

Visit http://www.pens2paper.com - For Your Stationery Needs!
Renegadeandy is offline   Reply With Quote
Old 04-30-2006, 04:18 PM   #9
Fully Optimized
 
Paradox's Avatar
 
Join Date: Aug 2005
Posts: 2,913
Send a message via AIM to Paradox Send a message via MSN to Paradox Send a message via Yahoo to Paradox
Default Re: Programming Question that has me stumped

its console based, And the source code was too long to post (7 header files, 1 source, each around 2-5 pages long)

anyways, I got it working by saying if top left was selected and if top left did not = marker 1, and if top left did not = marker 2 then it would be applied as whoever was marking it.

then left an else at the end saying that it was either already selected, or the selection was not valid
__________________

__________________
ROW ROW FIGHT THE POWAH

Xbox Live: Error Lord
Personal Email: HunterMRose[at]gmail.com
Aim: Error Lord
Paradox is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 05:42 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0