The following diagram explains how a dart is allocated a score in a game of darts.

To calculate the score of an arrow based on its (x,y) coordinates we will use two calculations:
- The distance of the arrow from the centre of the target,
- The angle matching the arrow position.
Calculating the distance
To calculate the distance of the arrow from the centre of the target, we will use the Pythagora’s Theorem:

You can review this blog post where we have used a similar approach to calculate the score of an arrow in a game of archery.
We will then be able to use this distance to check where the arrow landed:
- Bull’s Eyes (Red inner circle)
- Bull (Green inner circle)
- On target (Black or white zones)
- On the triple ring
- On the double ring
- Outside of the target
To do so you will need the dimensions of the target (in pixels). These are given on the diagram below:

Calculating the angle
To calculate the angle we will use the trigonometric formulas (SOCATOA):
Using the following angles your program can then figure out the score for the arrow:

Complete the code
Check the code below used to display the dartboard and to throw an arrow by generating random (x,y) coordinates.
Complete the code to calculate both the distance and the angle of the arrow based on the (x,y) coordinates of the arrow. Use this information to find out the actual score of the arrow.
Extension Task
Adapt your code so that the computer throws three darts. Your script should then calculate the total score of the three darts.

Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area



Monarchs-of-England.csv
In this challenge we will use file handling techniques to read through and access the content of different text files.
When your browser displays a webpage on screen it uses 3 different programming languages called HTML, CSS and JavaScript. We call the combination of these three languages “client-side web technologies”.

When your browser displays a webpage on screen it uses 3 different programming languages called HTML, CSS and JavaScript. We call the combination of these three languages “client-side web technologies”.




Computers hardware consists of all the components that you will find inside the computer (Motherboard, CPU, RAM, graphic card, sound card, network card, etc.) as well as all the peripherals/devices than you can plug to a computer.



