Programming in Alice
You will be working with the Alice environment for developing virtual worlds. There are many resources to help with this assignment, including
- sample Alice worlds available online from lecture and needed for this lab
- reference texts in CS lounge (KINSC H111)
- online help at the Alice website, including free download of the application
- application help and tutorials
- TAs available Sundays - Thursdays in the evening in the CS Teaching Lab (although Alice is installed
in the Science Computer Lab (KINSC H204) as it currently only runs on the Macintosh and Windows platforms at Haverford, we may try Linux later, but ....
- J.D. office hours and by appointment
As seen in certain events (e.g., gynmastics, debate), proficiency in this lab will be determined by a set of compulsory exercises, followed by an open demonstration program.
Warm-up Exercises (optional):
- complete the first two tutorials in Alice
- open an existing example world and modify it:
- make an existing object either talk, think, or make a sound
- move an existing object
- add an object to a world, and then make it do something simple
- create a new, simple world with two objects, amd move one toward the other
- create a world method, and call it from the main() method (first method)
- now add an event to call your method when an object is clicked
- download and experiment with the worlds from lecture:
These sample virtual worlds, along with those needed in this lab, have been placed
in KINSC H204 on most of the machines under the folder "Alice worlds".
- experiment -- it is a lab!
Compulsory Exercise 1: Alice Walk in the Field
- download from Blackboard course documents and open the Alice virtual world alice-field-walk-template (you can also build alice-field-walk-template -- (use only if you cannot get the sample worlds)
- play the world "as is"
- "fix" the method square-loop to use the appropriate control structure
- generalize this touring algorithm by completing the "n-gon-tour" method for 1 hint: it should look alot like "square-loop"
- save the completed world in a folder
yourlastname.2 for later submission
Compulsory Exercise 2: Penguin Array Search
- now download the world penguin-array-template, and complete the following:
- play the world "as is," changing the value of
target-color in world.my first method a few times
- note in the output at the bottom that the value of a location is displayed; look at the ArrayVisualization method
where-in-array(), presently incomplete
- complete the method
where-in-array(), where the input to the method is the color, and the output is a number indicating the location of the color in the array (recall that locations in an array of size N are between [0, N-1], or 0 <= location < N)
- you can assume for now that the color is in the array, but there is extra credit [+5] if you can check this explicitly (and what would you return if the color was not in the array?)
- put the revised "penguin-array" world in a folder
yourlastname.2 for later submission
Required Open Exercise: Design and implement an Alice short
movie (less than 30 seconds, please -- think of a commercial on TV) where at
least two objects (at least one non-trivial) interact in an engaging fashion
-- creative and concise work is appreciated. This program will be evaluated
on the merits of the short story as engaging entertainment (as seen by J.D.),
as well as the creative use of programming concepts from class (please use comments
to mark each concept implemented) -- concepts include (but not limited to):
- selection
- repetition
- methods as sub-programs
- functions (that return a useful value)
- data types (number, boolean, object)
- parameters
- recursion
- lists and list processing
- random numbers
- searching, sorting, other list operations
Please note that you do not have to include each concept, just some -- do not force your world into some unwanted unwanted state.
Save the completed world in the same folder yourlastname.2 from the previous exercises -- the name of this world is your choice, as long as it is in the right folder and is NOT (alice-field-walk-template OR ninja-list-template).
Optional Exercise: Ninja Sort (only attempt after completing the required parts above)
- download ninja-list-template from Blackboard
- play the world "as is"
- complete the recursive traverse of the ninjas (i.e., list) [+5]
- complete the sort-ninjas method (suggest selection sort)[+15]
- fix the sort-ninjas-rec and rec-sort methods (these are recursive)[+25]
- again, save the completed world in the same folder
yourlastname.2
Submitting Lab 2: Please submit an archive of the folder yourlastname.2 containing the two (or possibly three) Alice world files into the Lab2 dropbox on Blackboard:
- alice-field-walk-template
- penguin-array
- a name of your choice
- ninja-list-template (optional)
In other words, please do not include the lecture samples boot-looping, space-team, or any other examples/worlds.
Students can also bring media (e.g., USB disk, floppy, ZIP-100, CD-ROM) to class or J.D.'s office -- please do not email the files, they are just too big.
CS100 Labs: 0 1
2 3
Schedule Links