Homework 4
Home   Lectures   Solutions   Syllabus      Instructor's Site  
Homework 4 - Due Monday 26 February at 11:59pm.

This homework assignment assumes that you have worked through the assigned reading for this week (DC&P Ch. 3 and Ch. 7). If you have not done so already, please do so now. You will find the assignment extremely difficult, if not impossible if you do not read these chapters.

  1. (Hw4Ex1.a2w) Exercise 1 on pp. 196-197 of DC&P. Save to K drive.
  2.  
  3. (Hw4Ex2.a2w) Write a second version of exercise 1, that uses a while loop to make the bunny hop up to the brocolli. The bunny should hop toward the brocolli until she is within 1 meter of it. You will need to use a primitive Alice function to do this. Save to K drive.
  4.  
  5. (Hw4Ex3.a2w) Alice contains Hebuilder and Shebuilder class tiles in the People folder of the Local Gallery. You can create your own character objects in Alice using these. The new character will have a method to walk. Create an Alice world with a character of your own creation as an object in the world. Using the walk, move, and turn methods, and a loop, create an object method for your character that will make the character walk around in a complete circle. Please note that you should NOT use the method we discussed in class for making the shark swim around the island. You are asked to write an object method here that assumes the existence of no other objects in the world. Save to K drive.