Water Polo Challenge

water-poloIn this challenge you are going to use Python code to score a goal in a game of Water Polo.

To do so you will use the code given below. You will pass the ball from one player to another using a subroutine called throwBall(). This subroutine takes two parameters as follows:

  • angle: an integer value between 0 and 360 degrees to represent the direction of the throw. (e.g 0° would throw the ball to the right, 90° straight ahead and 180° to the left).
  • power: an integer value between 0 and 200 representing how far you can throw the ball.

This diagram will help you identify your angles when throwing the ball:angle-0-to-360

In this challenge you have the red team. Make sure than, when passing the ball or trying to score a goal (in the goal at the top), you do not throw the ball over a white player who would then intercept it. Also make sure that each throw either reach a team member (red team) or the top goal.

Complete the code to score a goal


Did you like this challenge?

Click on a star to rate it!

Average rating 3.3 / 5. Vote count: 45

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: , ,