Review1

Created by Prof. Rodger

You need to download Java software in order to view this Alice world. Please visit this page: http://www.alice.org/applet/requirements/

Created with Alice, the easy-to-learn programming system. Provided free as a public service by Carnegie Mellon University


If you don't see 3d graphics on this page, click for help.

Review1's Code

Created by:

world

Events

When the world starts
Do:
world.my first method


Methods

  world.my first method ( )
    No variables
       world.runAndChase animal = Chicken person = aliceLiddell
  ( world.personToMyRight person1 = wheely person2 = wizard person3 = troll ) turn right 1 revolution
  ( world.personToMyRight person1 = wheely person2 = troll person3 = wizard ) turn right 1 revolution
  ( world.personToMyRight person1 = troll person2 = wizard person3 = wheely ) turn right 1 revolution
  ( world.personToMyRight person1 = troll person2 = wheely person3 = wizard ) turn right 1 revolution


  world.runAndChase ( [Obj] animal, [Obj] person)
    No variables
       Do together
       animal turn to face person
  person turn to face animal
  animal move forward ( ( ( animal distance to person ) - 1 ) )
  animal turn right 0.25 revolutions
  animal turn left 1 revolution asSeenBy = person
  animal say catch me if you can
  animal turn right 0.25 revolutions
  Do together
       animal move forward 20 meters duration = 1 second
  person move forward 20 meters duration = 1 second


Functions

  Object world.personToMyRight ( [Obj] person1, [Obj] person2, [Obj] person3)
    No variables
       If ( both ( person2 is to the right of person1 ) and ( not ( person3 is to the right of person1 ) ) )
       Return person2
  Else
    If ( both ( person2 is to the right of person1 ) and ( person3 is to the right of person1 ) )
       If ( ( person1 distance to person2 ) < ( person1 distance to person3 ) )
       Return person2
  Else
    Return person3
  Else
    Return person3
Return <None>