MCB419 logo  




Homework

MCB 419 Homework 1 (Spring 2008)


Questions appearing in red are to be answered in the hw01.txt file.

When you've finished answering all the questions, email a copy of the file (hw01.txt) with your responses, as a PLAIN TEXT file. (DO NOT ATTACH A WORD PROCESSING DOCUMENT)

Email to mcb419@gmail.com with 'hw01' in the Subject line.

The homework is due by 11:59PM on Tue, Jan 22.


First-time instructions for using Squeak
(assuming you're using a Windows-based EWS computer)

  1. create an 'mcb419' folder in your EWS home folder.
    Open the EWS Home Directory icon on the desktop.
    Right click, select New -> Folder, rename it mcb419.
    This is where your squeak projects will be saved.
  2. create a shortcut to squeak in your EWS home folder.
    Within your home folder, right click and select New -> Shortcut
    Browse to 'C:\Program Files\squeak\SqueakPlugin.exe'
  3. associate *.pr files with squeak
    In the menubar at the top of your EWS Home Directory Window,
    select 'Tools -> Folder Options -> File Types'
    Click 'New', add file extension 'pr', click 'Change...'
    Browse to 'C:\Program Files\squeak\SqueakPlugin.exe'
    Check 'always use the selected program to open this kind of file'
  4. look at the Squeak Etoys Quickstart Guide

Part A: Etoys Challenge

EtoysChallenge

EtoysChallenge
A simple introduction to tile-based programming in Etoys. The project contains 7 challenges in which you create simple scripts to drive a car to a goal location. Each challenge becomes a bit more difficult.

Assignment: complete the Etoys Challenge (start by clicking on the image above).

1. What message is displayed the final page of the EtoysChallenge?


Part B: Lunar Lander Game

LunarLander

Lunar Lander
Example of an Etoys-based game. Use the joystick to control a rocket thruster, so that the spaceship sets down gently on the landing pad. Examine all the scripts and try to figure out how this project works.

Assignment: after playing with the Lunar Lander game and exploring the scripts, modify the project so that it:
   a) displays a text box saying 'YOU WIN!' in large GREEN letters when the ship lands safely.

   b) displays a text box saying 'YOU LOSE.' in large RED letters if the ship crashes.

   c) hides both text messages when the game is reset.
HINT: create two 'text (bordered)' objects, with appropriate text and appropriate names; use the 'hide' and 'show' tiles found under 'miscellaneous' in the objects brower to display the proper message.

Save your modified project as MyLunarLander in your mcb419 directory. The result of a successful landing might look something like this:

hw01_landed

2. Which scripts did you modify to get the 'You Win!' and 'You Lose.' messages working in the LunarLander project?


Part C: Movement strategies

An important component of adaptive behavior is the ability of an organism to control how it moves through its environment. Here you'll simulate some movment patterns for a simple creature in a 2D environment.

One important element of movement control is the speed at which an animal moves. In general this scales with the body size of the organism. Speeds are often quoted in "body-lengths per second". It turns out that a speed of 1 body-lenght per second is pretty typical.

When you are strolling along casually, you might cover 1 mile in 20 minutes; if you go out for an jog, you might cover 1 mile in 8 minutes; if you're a world-class runner, you might be able to cover 1 mile in 4 minutes."

3. Estimate human 'walking', 'jogging' and 'sprinting' speeds in body-lengths per sec?

HINT: the calculator built into the google search box lets you do cool things like: '5280 feet / 8 minutes in m/s'


Part D: Your first Squeak project

  • Create a new squeak project (use the menubar at the top of the squeak page, second icon from the left), then click on the new rectangle named 'Unnamed' to open your new project.
  • Drag out a playfield from the supplies bin.
  • Resize the playfield to 400 by 400 (under 'geometry' in the object browser).
  • Drag a yellow ellipse into the playfiled.
  • Resize the ellipse to 20 (length) by 10 (width).
  • Create a new script named 'move' with the following code:
            Ellipse forward by 5
            Ellipse turn by 5
    
  • Set the Ellipse's 'pen down' variable to 'true' (under 'pen use').
  • Run the simulation by clicking on the clock icon. Click again to pause the simulation after the Ellipse has completed a full circle.
  • Click the clock icon and hold without releasing for about 2 seconds. The clock rate will appear. Note that the default is 8 ticks/sec. We'll need this later.
Your simulation environment might look something like this:

hw01_playfield

4. If the ellipse moves forward by 5 units on each tick, and the tick rate is 8 ticks/s, what is the speed of the ellipse in body-lengths per second (recall the Ellipse has length=20)? Is the Ellipse 'walking', 'jogging', or 'sprinting'?

5. For the simulation above

  1. if the ellipse turns by 5 degrees on each tick, how many ticks are required to complete a full cicrle?
  2. if the ellipse moves forward by 5 units on each tick, how far would it travel in the time needed to complete a full circle?
  3. what is the predicted diameter of the resulting circle?
  4. what is the diameter as measured with the ruler tool in squeak?

6. For the following script:

      Ellipse forward by 5
      Ellipse turn by 3
what is the predicted diameter of its movement circle?

7. In squeak, random(N) generates random integers from 1 to N, with equal probability. What do you expect for the mean value of random(5), averaged over multiple calls to the function?

8. For the following script:

      Ellipse forward by 5
      Ellipse turn by random(5)
what is the approx. diameter of the resulting trajectory?

9. Implement and briefly describe the behavior arising from each of the following scripts:

    a) Ellipse forward by 5
       Ellipse turn by random(5) - 3


    b) Ellipse forward by 5
       Ellipse turn by random(5) - 3
       Ellipse bounce silence


    c) Ellipse forward by 5
       Ellipse turn by random(99) - 50
       Ellipse bounce silence


    d) Ellipse forward by 5
       Ellipse turn by random(360)
       Ellipse bounce silence


Part E: Weekly reading assignment

10. Why does Hawking think that continued evolution of intelligence may shift from biological life forms to self-designing, self-replicating electromechanical "life" forms? What do you think about that idea?

11. According to the article by Crist, what observations prompted Darwin to conclude that earthworms exhibit some degree of intelligence? How does this fit with your own personal ideas about what qualifies as 'intelligence'?


Copyright © Mark E. Nelson, University of Illinois at Urbana-Champaign, 2005-2008. All rights reserved.