Computer Science Canada

Othello help

Author:  JonnyBigBoi [ Tue Jan 11, 2005 12:00 pm ]
Post subject:  Othello help

in my game othello im making for my computer class, i have the 4 peices to start in the middle of the board but if i click on the peices already colored they will change i was wondering how i could make it so the peices once they are on the board they cant be taken over

Author:  scottyrush13 [ Tue Jan 11, 2005 12:16 pm ]
Post subject: 

tsk tsk jonny, you already made a topic called othello help

you do realise that making multiple unneccesary topics is frowned upon in this forum right? Mad

....

just thought i'd get a word in before any of the mods Laughing

Author:  Cervantes [ Tue Jan 11, 2005 8:07 pm ]
Post subject: 

scottyrush13 wrote:
tsk tsk jonny, you already made a topic called othello help

you do realise that making multiple unneccesary topics is frowned upon in this forum right? Mad

....

just thought i'd get a word in before any of the mods Laughing

You're absolutely right. It's getting incredibly annoying to have to sift through a bunch of your threads to figure out which is the latest and where you need help. Really, it's an awful lot of work, just to help you.

Author:  JonnyBigBoi [ Thu Jan 13, 2005 12:13 pm ]
Post subject: 

K, well i have figured out how that my topic goes to the top after i post a reply so hopefully the mods will forgive me and help me out...

OK, my question is how would i make my game so when i click on a spot that is already occupied the spot will not change color it will just stay the same and not change. thx.

Author:  Buen [ Thu Jan 13, 2005 12:18 pm ]
Post subject: 

JonnyBigBoi wrote:
K, well i have figured out how that my topic goes to the top after i post a reply so hopefully the mods will forgive me and help me out...

OK, my question is how would i make my game so when i click on a spot that is already occupied the spot will not change color it will just stay the same and not change. thx.


Keep track of what is colored in or not using an 2D array, it would mimic the actual grid and you can either use numbers lik 1 = Occupied and 0 = Empty or even a boolean type array (True and False, representing Occupied and Empty respectively.)

Author:  scottyrush13 [ Thu Jan 13, 2005 12:30 pm ]
Post subject: 

Quote:

JonnyBigBoi wrote:
K, well i have figured out how that my topic goes to the top after i post a reply so hopefully the mods will forgive me and help me out...

OK, my question is how would i make my game so when i click on a spot that is already occupied the spot will not change color it will just stay the same and not change. thx.


Keep track of what is colored in or not using an 2D array, it would mimic the actual grid and you can either use numbers lik 1 = Occupied and 0 = Empty or even a boolean type array (True and False, representing Occupied and Empty respectively.)


nikk/buen...i beleive is right on this one, this is what i would try if i was in your situation, i think you could do a little readon up on the tutorials and then ask questions if you still dont understand...

just telling you to read the tutorials before the mods do Very Happy Laughing

Author:  JonnyBigBoi [ Thu Jan 13, 2005 12:31 pm ]
Post subject: 

code:
loop
    var turnCounter : int
    var grid : array 1 .. 8, 1 .. 8 of real
    turnCounter += 1
    if grid (8, 8 ) = 0 then
        grid (8, 8 ) := turnCounter mod 1
    end if
end loop


this is what i have as of now 15 mintues before then end of class Smile it does not seem to work its probably completly wrong.

Author:  Buen [ Thu Jan 13, 2005 12:35 pm ]
Post subject: 

JonnyBigBoi wrote:
loop
var turnCounter : int
var grid : array 1 .. 8, 1 .. 8 of real
turnCounter += 1
if grid (8, 8 ) = 0 then
grid (8, 8 ) := turnCounter mod 1
end if
end loop

this is what i have as of now 15 mintues before then end of class Smile it does not seem to work its probably completly wrong.


Please "code" your code for it looks a little easier to read and we know what is what. Just getting a word in before the mods do Very Happy Though using just single numbers might be cleaner than real numbers Wink

Author:  scottyrush13 [ Thu Jan 13, 2005 12:38 pm ]
Post subject: 

Quote:
Please "code" your code for it looks a little easier to read and we know what is what


jonny, nikk is right again, it gets confusing for the people tryin to help you when we have to try and figure out where your code starts and where it ends.

Author:  scottyrush13 [ Thu Jan 13, 2005 12:44 pm ]
Post subject: 

jonny please dont try to deceive the mods by editing afterwards, even though we appreciate the afterthought the damage has been done already, we thank you anyways. and i would appreciate it jonny if you would not be disrespectful towards cervantes, he is the only one who is willing to help me and the only reason you arent being helped is because you wont follow the rules of the forum

Author:  scottyrush13 [ Thu Jan 13, 2005 12:47 pm ]
Post subject: 

now i think its best that we discontinue spamming this topic and you start following the rules of the forum, but please do not spam this by asking questions that can be answered by reading around the site, unless you read around and honestly are still confused

NO MORE SPAMMING OF THIS TOPIC!

Author:  Buen [ Thu Jan 13, 2005 4:11 pm ]
Post subject: 

scottyrush13 wrote:


NO MORE SPAMMING OF THIS TOPIC!


You the one who posted the last 3 times in a row Confused

Author:  Cervantes [ Thu Jan 13, 2005 4:33 pm ]
Post subject: 

scottyrush13 wrote:
jonny please dont try to deceive the mods by editing afterwards, even though we appreciate the afterthought the damage has been done already, we thank you anyways.

Deceive the mods? Well, I don't know what was there, but, if he's deceiving the mods, he's deceiving everyone. Anyways...
scottyrush13 wrote:

and i would appreciate it jonny if you would not be disrespectful towards cervantes, he is the only one who is willing to help me

Maybe I missed it, but I don't remember him being disrespectful to me. Just making a ton of different threads that aggrivated me.
scottyrush13 wrote:

the only reason you arent being helped is because you wont follow the rules of the forum

Yeah, so many threads is annoying. I hope you've learned how the boards function, Jonny, and will from now on keep all your related questions in the same thread.

Lastly,
JonnyBigBoi wrote:

code:

loop
    var turnCounter : int
    var grid : array 1 .. 8, 1 .. 8 of real
    turnCounter += 1
    if grid (8, 8 ) = 0 then
        grid (8, 8 ) := turnCounter mod 1
    end if
end loop


Don't declare variables inside the loop. Turing will allow you to, but it's best not to. Besides, in this case, assigning them inside the loop doesn't even save you any lines.
And, you've got it right. The only thing you have to do is change grid (8,8 ) to grid (x,y) where x and y are numbers from 1 to 8 that are determined based on the location and characteristics of the grid, and the location of the mouse.
-Cervantes

Author:  JonnyBigBoi [ Thu Jan 13, 2005 6:42 pm ]
Post subject: 

k thx alot for the answer and ill be sure to only use one thread for the same questions.
k, how would i limit the spots that can be taken to just the open spaces around the ones already taken. here is what i have

Author:  scottyrush13 [ Thu Jan 13, 2005 8:02 pm ]
Post subject: 

cervantes he didnt say anything on the forum...said it in class (hes in my class, along with buen)

but im pretty sure he was joking...WERENT YOU JONNY? Mad

Author:  AsianSensation [ Thu Jan 13, 2005 8:12 pm ]
Post subject: 

quit spamming, warning counted.

Author:  JonnyBigBoi [ Fri Jan 14, 2005 12:33 pm ]
Post subject: 

code:
var turnCounter : int
var grid : array 1 .. 8, 1 .. 8 of real
var x, y : int

loop
    turnCounter += 1
    if grid (x, y) = 0 then
        grid (x, y) := turnCounter mod 1
    end if
end loop


this does not seem to work its suposed to make it so i cant place a peice over the peice that is already there, but it still does if anyone could help id love it.

Author:  Andy [ Fri Jan 14, 2005 3:48 pm ]
Post subject: 

heh othello.. nice game, i i made that a while back the source is attatched

Author:  Cervantes [ Fri Jan 14, 2005 4:23 pm ]
Post subject: 

JonnyBigBoi wrote:
code:
var turnCounter : int
var grid : array 1 .. 8, 1 .. 8 of real
var x, y : int

loop
    turnCounter += 1
    if grid (x, y) = 0 then
        grid (x, y) := turnCounter mod 1
    end if
end loop


this does not seem to work its suposed to make it so i cant place a peice over the peice that is already there, but it still does if anyone could help id love it.

It should work correctly, provided the rest of your program is correct. Have you assigned every element of the array to equal zero, just after you declare the array, near the top of your program?

Author:  JonnyBigBoi [ Sat Jan 22, 2005 7:07 pm ]
Post subject: 

no how would i do that?

Author:  Cervantes [ Sat Jan 22, 2005 7:12 pm ]
Post subject: 

Turing:

for x : 1 .. 8
for y : 1 .. 8
  grid (x,y) := 0
end for
end for

Author:  JonnyBigBoi [ Mon Jan 24, 2005 12:22 pm ]
Post subject: 

what else would i need to have in order to make them work properly


: