Objective: Calculate the points scored in Darts game.
Darts is a game where players throw darts at a board like the one in the image. For this exercise we will define a set as the set of 10 throws per player. A game will be 3 sets per player.
In our particular instance of the game, the target rewards 4 different amounts of points, depending on where the dart lands:
The outer circle has a radius of 10 units (this is equivalent to the total radius for the entire target), the middle circle a radius of 5 units, and the inner circle a radius of 1. Of course, they are all centered at the same point — that is, the circles are concentric defined by the coordinates (0, 0).
Given the following type:
throwDart(range: number): DartThrow
to produce a random throw within a range.throwDartWithChance(insideBoardChance: number): DartThrow
that can be used to generate a throw with a particular chance to hit the board.