Listing 3. Source code for the program named Alice0180c.

Alice0180c's Code

Created by: Dick Baldwin

world

Events

When the world starts
Do:
world.main ( );


Methods

  public void main ( ) {
    Number limit = 5 ; Object[] objectsA = ; Object[] objectsB = ;
       // Copyright 2007, R.G.Baldwin
  doInOrder {
       // Illustrates setting one array to another array
  // producing two arrays with same set of objects.
  // User input was eliminated for brevity.
  }
  doInOrder {
       // Add objects to the first array.
  objectsA [ 0 ] = penguin ; duration = 0 seconds
  objectsA [ 1 ] = cow ; duration = 0 seconds
  objectsA [ 2 ] = hare ; duration = 0 seconds
  objectsA [ 3 ] = monkey ; duration = 0 seconds
  objectsA [ 4 ] = tortoise ; duration = 0 seconds
  }
  for (int index = 0 ; index< limit times ; index += 1 ){
       // Make objects in first array become visible.
  ( objectsA [ index ] ) .set( opacity , 1 (100%) );
  }
  // Set second array to first array.
  objectsB .set( value , objectsA );
  for (int index = 0 ; index< limit times ; index += 1 ){
       // Move objects in second array and color them orange.
  // These are the same objects as the objects in
  // the first array.
  ( objectsB [ index ] ) .move( FORWARD , 1 meter );
  ( objectsB [ index ] ) .set( color , ORANGE );
  }
  penguin .say( That's all, Goodbye ); duration = 5 seconds
  }