Computer Science Canada Matching card game problems. |
Author: | lollipopgirl [ Tue Jan 17, 2006 6:09 pm ] |
Post subject: | Matching card game problems. |
k...i am done half part of my match card but I dun know how to add score to the matched card and made those wrong matched card disappear..Itz due tmr and i stilll haf no idea how to fix it..plz help and this is my program so far.. Martin says: Fixed the title. Carry on. |
Author: | lollipopgirl [ Tue Jan 17, 2006 6:25 pm ] | ||
Post subject: | I posted it here | ||
i posted it here
|
Author: | Delos [ Tue Jan 17, 2006 7:14 pm ] | ||||
Post subject: | |||||
OMG DON'T MAKE YOUR TITLES IN ALL CAPS. Seriously, it's a little annoying. Anyway, what you're looking at here is a case of matching variables. I see you're using the array 'mark' to hold the values of the cards. What you'll do is randomly assign numbers to mark. For instance:
Once you've done that you'll draw all your circles using the value of each element of mark to determine what colour will be used. The main challenge will come once all the circles have been covered up. Here, you'll have to take sets of two mouse clicks. Each will open up one of the boxes. You will need to know which boxes have been opened (for your intents, this means having a second array that will hold values indicating 'open' or 'closed' - i.e. boolean). If you don't understand booleans, or don't want to, just use numbers (something like '0 means closed', '1 means open' type thing). Once both are open, compare the values in 'mark'. If both numbers are the same, you're good. So, to graphically summarize:
And there you go. Try working around those ideas, and good luck. |
Author: | lollipopgirl [ Tue Jan 17, 2006 7:36 pm ] |
Post subject: | |
ok..i giave each pair a num, and i use a var named open to control the box is open or close, i am still confused about how do u do it. |
Author: | Rasta Fella [ Tue Jan 17, 2006 7:45 pm ] |
Post subject: | |
Delos wrote: OMG DON'T MAKE YOUR TITLES IN ALL CAPS. Seriously, it's a little annoying.
Quite, hypocritical if you ask me. But Delos is right, lollipopgirl you should check and read over the Rules of this forum, that way more users will respect you. I wonder how many people actually read the rules?..O well... |
Author: | lollipopgirl [ Tue Jan 17, 2006 8:05 pm ] | ||
Post subject: | |||
the mousewhere did not work sumhow it work well b4
Martin says: Added code tags ![]() |
Author: | lollipopgirl [ Tue Jan 17, 2006 8:06 pm ] | ||
Post subject: | |||
the mousewhere did not work, i m sure i work well b4
|
Author: | Delos [ Tue Jan 17, 2006 8:31 pm ] |
Post subject: | |
I guess you didn't quite understand what I was trying to say. You don't want a single variable for 'OPEN'. You want an array thereof. This array is to match the array you already have for the circles, hence it will be able to tell you what state each box is in (open or closed, 1 or 0). Now you can use those values to determine which boxes have been opened, and hence compare the correct set of numbers. If they match, you could (for example) set their values in 'OPEN' to '2', or '-1', or '32' or some value to indicate that they are no longer in play. If they do not match, simply close them (set their 'OPEN' value to 0 and redraw the box over them), and start the click-check again. |
Author: | lollipopgirl [ Tue Jan 17, 2006 8:42 pm ] | ||
Post subject: | |||
ok..i got it but what is the problem with my mousewhere...
|
Author: | lollipopgirl [ Tue Jan 17, 2006 8:55 pm ] |
Post subject: | |
i fixed my mousewhere but my matched pair wont add up score is this command right? if mark (1, 1) = mark (3, 2) and OPEN (1, 1) not= 0 and OPEN (3, 2) not= 0 then p1mark := p1mark + 1 put p1mark elsif OPEN (1, 1) = 1 then drawfillbox (300, 300, 400, 400, blue) end if |
Author: | Delos [ Tue Jan 17, 2006 9:16 pm ] |
Post subject: | |
You're getting the idea now. - Remember that you'll want to be able to check the status of *all* boxes, not just (1,1) and (3,2). So basically, you'll be using the values of OPEN to determine which boxes are open, then compare the values in 'mark' of those specific values. - Don't forget to reset all values of OPEN if the player does not find a match (do this with two for loops (a nested for loop) instead of manually). - Also, not too sure what the procedure 'choice' is supposed to be doing |
Author: | lollipopgirl [ Wed Jan 18, 2006 10:19 am ] |
Post subject: | |
I got what ur r saying but i dun know how to do it in command.. ![]() |
Author: | lollipopgirl [ Wed Jan 18, 2006 10:40 am ] | ||
Post subject: | |||
i did this but it wont work..
|
Author: | lollipopgirl [ Wed Jan 18, 2006 10:48 am ] | ||
Post subject: | |||
newest code! ![]() |
Author: | Albrecd [ Wed Jan 18, 2006 5:30 pm ] |
Post subject: | |
What you could do to make them disapear again is have a counter that one is added to every time a card is turned over, and if it = two then the program checks to see if the two circles are the same, and if they are not the same, it draws their respective boxes back on top of them. |