Alice Community  

Go Back   Alice Community > Alice 2 > Works-In-Progress

Reply
 
Thread Tools Display Modes
Buoy List, Boooyyyyy.
Old
gballa1993
Junior Member
 
Status: Offline
Posts: 5
Join Date: Dec 2013
Location: Louisiana
Default Buoy List, Boooyyyyy. - 01-11-2014, 06:20 PM

"To determine when the game is over, you need a way to know when all the buoys have been picked up. To track the buoys that have been picked up, create a second world-level list, this one named picked UpBuoys and leave it empty. In the pickUpBuoy method, create a statement that adds the picked up buoy to the pickedUpBuoys list. Create a world-level method named checkIfGameIsOver and call it every time a buoy is picked up. When the size of pickedUpBuoys is equal to seven, the player wins the game and a 3D text object is used to display "You did it!".

Taken from Learning to program with Alice, 3rd Ed. by Wanda P Dann, Stephen Cooper, and Randy Pausch.


So, here's the issue. I've completed the majority of the assignment. Now comes the tricky part, I need to be able to add a +1, to the pickedUpBuoys list whenever I pick up a buoy, and this is driving me insane. Where is my program going wrong, I'd like some perspective, not a laid out list of what to do.
Attached Files
File Type: a2w pick up all buoys.a2w (838.7 KB, 72 views)
   
Reply With Quote
You might have misinterpreted the instructions.
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default You might have misinterpreted the instructions. - 01-12-2014, 05:42 PM

I don't have a copy of the book, but the instructions would seem to indicate that two object lists are needed. One for the unfound allBouys, and one for the pickedUpBouys.
When a picked new bouy is encountered, it is to be removed from allBouys, and added to pickedupBouys. Eventually the size of the second list will equal 7.

Also, if you are using 2.4.1, the "while world is running" event might be broken.
   
Reply With Quote
Old
gballa1993
Junior Member
 
Status: Offline
Posts: 5
Join Date: Dec 2013
Location: Louisiana
Default 01-13-2014, 05:41 PM

See, but I'm trying exactly that, but it doesn't give me the options. Presumably, I'm not doing the correct function.

Every time I try to remove from one list, and add to the other list, I don't know how to indicate at what position in the list that the item from allBuoys needs to go to. It always ends up putting a value of 1,1,1,1,1,1,1,1, etc. once I just pick up one buoy. I can't figure out the correct syntax to add/remove.
   
Reply With Quote
Hmm?
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Hmm? - 01-14-2014, 11:52 AM

Quote:
Originally Posted by gballa1993 View Post
See, but I'm trying exactly that, but it doesn't give me the options. Presumably, I'm not doing the correct function.

Every time I try to remove from one list, and add to the other list, I don't know how to indicate at what position in the list that the item from allBuoys needs to go to. It always ends up putting a value of 1,1,1,1,1,1,1,1, etc. once I just pick up one buoy. I can't figure out the correct syntax to add/remove.
Try looking at your list definitions again. They both need to be "Object" lists for it to work.
   
Reply With Quote
Old
gballa1993
Junior Member
 
Status: Offline
Posts: 5
Join Date: Dec 2013
Location: Louisiana
Default 01-14-2014, 02:36 PM

The only options it gives me when I choose for

If item_from_allBuoys.vehicle == sailboat

(insert correct statement)

The only options it gives me regarding the list are in this screenshot. And if I choose those, when I pick up a buoy, it continues adding that object, similar to the 1,1,1,1,1,1,etc.
Attached Images
File Type: jpg BuoyIssue.jpg (74.0 KB, 96 views)

Last edited by gballa1993; 01-14-2014 at 02:38 PM. Reason: Didn't realize the jpeg would show up
   
Reply With Quote
Stop! You are not reading what you think you are.
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default Stop! You are not reading what you think you are. - 01-15-2014, 08:20 AM

Of course this has never happened to ME, but I believe you are thinking your setup is basically correct and not carefully reading the responses.

You are meant to have two list of buoys one full and the other empty. Your second list is either not a list or not a list of buoys, if it was a list of buoys the results would not be 1,1,1, ... Due to the resolution I can not see the code in your attached picture and so can not be sure about what you are doing. I have however attached a movie that will show you the basic idea.

Hope this helps,
Mark
Attached Files
File Type: a2w BugList.a2w (1.26 MB, 48 views)


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote
The image was a little hard to Read
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default The image was a little hard to Read - 01-15-2014, 12:17 PM

But you are making progress.

Once you have identified an item in the first list, you can:

1) Add the list item to the (beginning or end) of a hit list.

2) Delete it from the original list so it can't be found again.

3) Perform whatever tasks need to be accomplished using the new hit list entry. To program the actions like turn or go invisible, you must first drag in the command using one of the original objects, then drag the array name in, and replace the original object name with appropriate list position.

If the first list becomes empty, you're done.
Attached Images
File Type: jpg Demo.jpg (23.6 KB, 94 views)

Last edited by MrMoke; 01-15-2014 at 01:08 PM. Reason: Added Image
   
Reply With Quote
Ahhhhhhh!
Old
gballa1993
Junior Member
 
Status: Offline
Posts: 5
Join Date: Dec 2013
Location: Louisiana
Default Ahhhhhhh! - 01-15-2014, 06:51 PM

I am so thick-skulled! Haha, thank you both very much, that actually makes much more sense now that I took a step back and looked at what I was actually trying to accomplish. If I do a

Do in order
If item_from_allBuoys.vehicle==sailboat
Add item_from_allBuoys.list to beginning of pickedUpBuoys.list
Remove item_from_allBuoys.list from allBuoys.list
Else
Do nothing

Does that sound fairly accurate?
I ask because my computer actually just took a dive, and I may have to re-image the hard drive. So..yay, starting over!
   
Reply With Quote
Ok
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Ok - 01-16-2014, 08:19 AM

I guess that would work as long as the item has already been attached to the sailboat somewhere else in the program.
   
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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.