Zebra0

Learn to Program Step-by-Step

Active Learning: A Soccer Game

Create an animation in Alice that does the following:
Two boys are practicing their soccer in the park. Repeat the following 3 times using procedures and functions where appropriate:

  1. Boy1 makes kicking motion and says “1” (the first time)
  2. Ball is moved a random distance between half the distance between the two boys and the full distance between the boys.
  3. Boy2 moves to the ball and makes a kicking motion and says “2” (the first time)
  4. Ball is moved a random distance between half the distance between the two boys and the entire distance between the two boys.
  5. The boys will say back and forth, "1", "2", "3", "4" . . . until they reach "6".
  6. If at the end, the boys are within 1 meter of each other, they both say "We won!" Otherwise they both say "We need more practice!"

Specifications:

  • Make sure the boys and the ball don’t collide with each other (use math operators for precise calculation of the distance between the front of the ball and the front of the other boy).
  • Use props to fill out the scene.
  • Use at least two variables
  • Use repetition and selection control statements.
  • Use procedures and functions where appropriate.

Suggestions: This is a longer program than previous ones.

  • Get one piece at a time to work, then save.
  • Keep working on it one piece at a time.
  • If you are having problems with one piece, disable those statements and come back to it.

soccermatch.pdf

Save the Alice3 program as lastName_firstName_soccer.a3p. For example mary_smith_soccer.a3p

Submit the lastName_firstName_soccer.a3p file.

Checklist

  • In the code there is a comment with your name and a description of the program. Each procedure or function has a comment. (1 point)
  • The boys and the ball don’t collide with each other, and the ball stays between them. (1 point)
  • At least 5 Props are used to create an appropriate scene. (1 point)
  • The boys alternate in counting to 6. (1 point)
  • The calculation uses random values and calculates the distance correctly. (1 point)
  • Procedures and functions are used where appropriate. (myFirstMethod should be mostly control structures and calls to procedures.) (2 points)
  • Appropriate control structures are used. (2 points)
  • Include a procedure that will have both boys say "We won!" if they are within 1 meter of each other.
    Otherwise they both say "We need more practice!" (1 points)
  • Create an mp4 for the discussion.
  • Save the program as lastName_firstName_soccer.a3p and submit in Blackboard under assignments.

Active Learning Index

Like us on Facebook:


OER: Open Educational Resource
Creative Commons License Author: Janet E. Joy; Publisher: Zebra0.com
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
Creative Commons Attribution-NonCommercial 4.0 International License
Last modified: May 25 2017 11:45:47.