Programming for non-majors – Unit 6

Learning Outcomes

  • Construct a scene
  • Demonstrate random movement
  • Demonstrate Boolean functions
  • Demonstrate the IF/ELSE command

To Do List

  1. Read chapter 6
  2. Watch lecture video
  3. Watch assignment video
  4. Complete assignment
  5. Complete chapter 6 quiz

Readings

  • Chapter 6 – Functions and IF/ELSE

Videos

Random Movement

 


Assignment

Instructions:
Have a penguin randomly move around and an Eskimo trying to catch the penguin. (Use an infinite loop).




Total points: 100

Add these objects:
  • Penguin – Animals (5 points)
  • Eskimo – People (5 points)
Create these methods:
  • Penguin – Create a method called “Random Move”(5 points), randomly turn the penguin to the left or right ¼ turn(10 points), randomly JUMP 20% of the time(10 points), randomly flap the wings 20% of the time (5 points)(using the built-in wing flap method)(5 points), use the built-in walk method (1 time)(5 points), and move the penguin 1 meter forward(5 points). Use IF/ELSE and the World function (under Random) called Choose True Probability of True to make the penguin turn, jump, and flap wings. You will need a separate IF/ELSE for turn, jump, and flap wings.
  • Eskimo – Create a method called “Move Eskimo”(5 points), turn Eskimo toward Penguin(5 points) and move the Eskimo 1 meter forward(5 points). Use iIF/ELSE to determine if the Eskimo is within 1 meters of the Penguin (10 points). If so, have the Eskimo say “I’ve caught the penguin”.
Other:
  • Add other penguins or objects that wander around (10 points).
  • Add other scenery objects (10 points).
  • Comment your program and all methods (10 points).

Quiz

Login to Blackboard and take the Chapter 6 quiz.

No comments:

Post a Comment