Alice Community  

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

Reply
 
Thread Tools Display Modes
Issues with arrays
Old
scaramouche
Guest
 
Status:
Posts: n/a
Default Issues with arrays - 03-28-2010, 01:20 AM

My assignment requires that when a target color is entered into the array (input) the program returns the location of the penguin with that color (output). How do I do this? This is my program so far...



Any advice is much appreciated, thanks.
Attached Files
File Type: a2w penguin-array-template2.a2w (1.06 MB, 12 views)
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 578
Join Date: Nov 2008
Location: In the interwebs
Default 03-28-2010, 08:16 AM

I would use a color variable for the input, an object variable for the output, and an object list of the penguins. Now, for all of the penguins, if their color is the input color, set them as the output. Just remember the list part, and not an array.


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 578
Join Date: Nov 2008
Location: In the interwebs
Default 03-28-2010, 08:19 AM

Actually, I looked at your code, and it's great! What isn't there? You can't prompt for colors very easily, but I'll see what I can do.


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
scaramouche
Guest
 
Status:
Posts: n/a
Default 03-28-2010, 01:53 PM

I used the template my professor created for the class, so that's probably where all of the "greatness" comes from. I pretty much have no idea what I am doing. I'm having alot of trouble tryingto figure out how to get the output part to work properly. I know I need to change the "return" command. But I'm not sure what to change it to?
   
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 ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.