Alice Community Comparing individual list elements
 User Name Remember Me? Password

 Thread Tools Display Modes
 Comparing individual list elements
 todd0312 Member     Status: Offline Posts: 35 Join Date: Sep 2011 Comparing individual list elements - 12-12-2011, 01: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
 TauTrumpsPi Senior Member     Status: Offline Posts: 399 Join Date: Mar 2011 Location: The diamond layer 12-12-2011, 01: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
 dakota95 Senior Member     Status: Offline Posts: 426 Join Date: Aug 2011 Location: like I would tell you. ;) 12-12-2011, 01: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?
 Simon:
todd0312
Member

Status: Offline
Posts: 35
Join Date: Sep 2011
Simon: - 12-13-2011, 10:21 AM

Here is be.
Attached Files
 click-it.vers.7.zip (384.9 KB, 10 views)

 New version
todd0312
Member

Status: Offline
Posts: 35
Join Date: Sep 2011
New version - 12-13-2011, 11:33 AM

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
 click-it.vers.9.zip (390.3 KB, 10 views)

 jediaction Senior Member     Status: Offline Posts: 5,064 Join Date: Jul 2009 Location: Bel Air, Maryland 12-13-2011, 09: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
 TauTrumpsPi Senior Member     Status: Offline Posts: 399 Join Date: Mar 2011 Location: The diamond layer 12-14-2011, 10: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

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge