COMP203: Assignment 1


Use the Assignment Manager to turn in your homework. If you get stuck, try following the instructions for students at http://blackboard.bridgew.edu/faculty_help/assignmang.cfm. Please include your full name and the assignment number in your document. Please submit your assignment in the form of a ".txt" text document.

Note: The commands cleartext, textscreen and clearscreen may be useful to you while working on this assignment.


  1. Do the fourth problem on the worksheet by Mike Koss. In other words, try to guess what will happen when Logo executes the following list of commands:
    FD 100
    BK 50
    RT 90
    FD 50
    LT 90
    FD 50
    BK 100
    PU
    RT 90
    FD 25
    LT 90
    PD
    FD 50
    PU
    FD 10
    PD
    FD 5
    HT
    
    If you're not sure what a command does, start Logo and ask about it! For example, typing help "HT causes Logo to tell you:
    HIDETURTLE
    HT
    
            makes the turtle invisible.  It's a good idea to do this while
            you're in the middle of a complicated drawing, because hiding
            the turtle speeds up the drawing substantially.
    

    You can also get help on instructions from files in the DOCS folder that came with your Logo installation or online at http://www.cs.berkeley.edu/~bh/usermanual.

  2. Edit the instruction from page 3:
    repeat 20 [repeat random 30 [type "Hi] print[]]
    to display one rectangular block of text (two examples shown below).
    ...............            """"""""""
    ...............            """"""""""
    ...............            """"""""""
    ...............            """"""""""
    ...............
    
  3. Write a procedure (a Logo program) named picture that uses the Logo commands forward, back, right and left to draw a simple design on the screen.

  4. Write a procedure converse based on the hi procedure on page 5 of the text. The conversation can take any form you like; one possibility is shown below.
    ? converse
    Is this your first year at Bridgewater?
    No.
    Neat!  What's your major?
    Mathematics
    That's my favorite subject!
    ?
    
    Hint: To make Logo pause and wait for an answer, use the command ignore readlist.
Bonus: (5 pts) Study the instruction on page 3 of the text:
repeat 20 [repeat random 30 [type "Hi] print[]]
Write an instruction (a line of Logo code) that generates a random number between 0 and 5. Test your instruction to make sure it works! (Remember that you can ask Logo for help understanding the command random.)