Curling Challenge

Curling is a sport in which players slide stones on a sheet of ice towards a target area which is segmented into four concentric circles. Two teams, each with four players, take turns sliding heavy, polished granite stones, also called rocks, across the ice curling sheet towards the house, a circular target marked on the ice. Each team has eight stones. The purpose is to accumulate the highest score for a game; points are scored for the stones resting closest to the centre of the house at the conclusion of each end, which is completed when both teams have thrown all of their stones. A game usually consists of eight or ten ends.

Challenge #1

We have created a Python script using Python Turtle to represent the target as well as the eight stones, randomly positioned above the target. Our algorithm randomly generates x and y coordinates between -170 and 170 for both coordinates. Each stone is a circle with a radius of 24 pixels. However our algorithm is not realistic as sometimes the stones are overlapping which would be impossible in a real game of curling.

Your challenge consists of tweaking this code to prevent two stones from overlapping. To ensure that there is no overlap between two stones you will need to use Pythagora’s theorem:

Challenge #2

The team who wins is the team who has the closest stone (to the centre of the target: coordinates (0,0)).

In this case the team scores points based on the number of stones resting closer to the target than any of the stones of the opposite team.

Your challenge consists of tweaking your code to find out who is the winning team and to calculate the score of the winning team.

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:

Did you like this challenge?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 10

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

As you found this challenge interesting...