Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Comparing individual list elements
Old
todd0312
Member
 
todd0312's Avatar
 
Status: Offline
Posts: 35
Join Date: Sep 2011
Unhappy Comparing individual list elements - 12-12-2011, 02:22 PM

Hey everyone:

Noob here.

I have this Simon game, and the way it is set up now, the "fail" method (if an incorrect circle was pressed) is not initiated until all the circles have been pressed. I want it to initiate as soon as a wrong circle is clicked. (I'm comparing the size - not the individual elements, but my brain is now addled, and I can't figure out a better way to compare).

I created a function called "check_mates" with 2 empty list parameters (list 1, list 2) that returns 1 if the lists are unequal:

If ((size of list)!=(size of list 2))
Return 1
Else: do nothing
Loop (size of list_1) from 0 up to (but not including) size of list 1 incrementing by 1.
If ((item index from list 1)!=(item index from list_2)
Return 1
Else: do nothing

Return 2

Next, I have a method to compare the lists called "world.check_Lists" to compare the variable that stores the moves the program has chosen: "world.program_turn" with the circles clicked by the player ("player_turn") for inequality:
It goes like this:

Do in Order:
If ((world.check_mates list 2 = world.player_turn/list 1=world.program_turn)==1)
world.missed set value to true
world.fail (method to display fail text initiated)
ELSE:
world.main

Can anyone tell from this code where I went wrong? I am a green noob; this is the first game I've ever made, and my head is swimming in variables.

Any advice as to what the problem might be would be greatly appreciated. I'm pretty sure it has something to do with looping the size of list 1 in my function - but this has turned out to be way more complex than I had planned, and my mind is so muddled at this point - that I'm probably missing something obvious.

Thanks in advance. If this wasn't clear, I'd be happy to explain it more fully.

Take care and good cheer,

Todd
   
Reply With Quote
Old
TauTrumpsPi
Senior Member
 
TauTrumpsPi's Avatar
 
Status: Offline
Posts: 399
Join Date: Mar 2011
Location: The diamond layer
Default 12-12-2011, 02:43 PM

Could you post your world, please? It would be more helpful if I could see the coding from within the context of the world


--------------------------------------------------------------------------------------------------------------------------
I have plenty of common sense. I just choose to ignore it.
-Calvin and Hobbes

Wondering about my Avatar?
http://en.wikipedia.org/wiki/Tardigrade

Wondering about my username?
http://www.youtube.com/watch?v=jG7vhMMXagQ
   
Reply With Quote
Old
dakota95
Senior Member
 
dakota95's Avatar
 
Status: Offline
Posts: 426
Join Date: Aug 2011
Location: like I would tell you. ;)
Default 12-12-2011, 02:45 PM

have you tried putting the if/else statement inside of an infinite loop? If it isn't in a infinite loop then it will only work if the mistake is made the first second of the game.

hope this helps.
Dakota

if that doesn't work then could you try elaborating on exactly what the problem Is? Could you try attaching your game so far?


<Insert_Signature_Here>
   
Reply With Quote
Simon:
Old
todd0312
Member
 
todd0312's Avatar
 
Status: Offline
Posts: 35
Join Date: Sep 2011
Default Simon: - 12-13-2011, 11:21 AM

Here is be.
Attached Files
File Type: zip click-it.vers.7.zip (384.9 KB, 10 views)
   
Reply With Quote
New version
Old
todd0312
Member
 
todd0312's Avatar
 
Status: Offline
Posts: 35
Join Date: Sep 2011
Default New version - 12-13-2011, 12:33 PM

I fixed some minor issues. So... I have gone ahead and posted this revised version to look at. I know this is overly complicated noob code (21 methods), but... oh well, due Thursday.

Just want to fix the list compare issue.

Thanks,

Todd
Attached Files
File Type: zip click-it.vers.9.zip (390.3 KB, 10 views)
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 12-13-2011, 10:33 PM

I'm sorry I wasn't able to help sooner. I see you are already getting help, I'll still take a look at it if you want?


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
TauTrumpsPi
Senior Member
 
TauTrumpsPi's Avatar
 
Status: Offline
Posts: 399
Join Date: Mar 2011
Location: The diamond layer
Default 12-14-2011, 11:00 AM

I've downloaded it, but I don't get what the point of the game is? Could you be a little more clear?


--------------------------------------------------------------------------------------------------------------------------
I have plenty of common sense. I just choose to ignore it.
-Calvin and Hobbes

Wondering about my Avatar?
http://en.wikipedia.org/wiki/Tardigrade

Wondering about my username?
http://www.youtube.com/watch?v=jG7vhMMXagQ
   
Reply With Quote
Reply

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



Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.