Reference no: EM13976704
According to https://en.wikipedia.org/wiki/Target_archery, standard FITA targets are marked with 10 evenly spaced concentric rings, which have score values from 1 through 10 assigned to them. In FITA archery, targets are colored as follows:
• 1 ring & 2 ring - white
• 3 ring & 4 ring - black
• 5 ring & 6 ring - blue
• 7 ring & 8 ring - red
• 9 ring, 10 ring - gold
a. Write a function called target to draw an archery target using turtle graphics; target should have a parameter that determines the size of the drawing, and the center of the target should be at the origin (0, 0). To specify the colors of each ring, use a tuple:ringColors = ("white", "white", "black", "black", "blue", "blue", "red", "red", "yellow", "yellow"). After creating this tuple, just set the fill color of each ring before you draw it. You can use turtle.fillcolor() to set the color, and then turtle.begin_fill() and turtle.end_fill() to actually fill the shapes with a particular color.
b. Write a function shoot that simulates firing an arrow towards the target. The effect of shoot should be to indicate visually where on the target (or near the target) the "arrow" lands. You can use turtle.dot() for this. The landing position should be at a pseudo-random position on or near the target. Look at the documentation for the Python module random and choose a suitable function to help you generate a pseudo-random position. To use turtle.dot(), you will need a random number for both the x-coordinate and the y-coordinate, so generate two random numbers for one dot. The return value of shoot should be the distance between the origin and the point at which the arrow lands. You can use turtle.distance() for this.
c. Write a function score, which takes as parameters the distance of an arrow from the origin, and the radius of the target, and calculates the score for that arrow, according to the above instructions. I.e., 10 points for the inner most circle, then 9 points for the next circle, etc., out to 1 point for the outer most circle, and zero for missing the target. You may need to use some of the functions in the math module. The return value of score should be the calculated score.
d. Write a function displayScorethat writes a score underneath the target. Give it suitable parameters. You can use turtle.write() to display information on the turtle canvas.
e. Complete your program for playing three-shot archery by writing the function threeShots that draws the target (by calling target), shootsthree arrows(by calling shoot and score three times), adds up the scores for all three arrows, and then displays the total score using the function displayScore. Naturally, threeShots should use the other functions that you have already defined. Give threeShots any necessary parameters.
f. Restrictions: Do not use any global variables. Global variables are declared outside of any function, so all variables for this assignment must be declared inside of one of the functions. Use parameters and return values to share information between functions.
g. Give your assignment an appropriate name (hw4LastName.py), and upload it to the dropbox like normal.
Find the occupation and the score of each player
: We saw in class how to represent a binary search tree in Prolog. Write a predicate lca (K1, K2, T) which allows one to find the smallest common ancestor of K1 and K2 in the tree T. The predicate lca shall print the subtree T such that the root is ..
|
Souvenir sheets cost the postal service
: The postal service of St. Lucia, an island in the West Indies, obtains a significant portion of its revenues from sales of special souvenir sheets to stamp collectors.
|
Complete the pension work sheet
: Using the above information for Marlin Corporation, complete the pension work sheet for 2015.
|
How much work does it take to bring them together
: Two point charges Q1 = 3.9 μC and Q2 = 7.7 μC are initially very far apart. They are then brought together, with a final separation of 2.4 m. How much work does it take to bring them together?
|
Write function displayscorethat write score underneath
: Write a function displayScorethat writes a score underneath the target. Give it suitable parameters. You can use turtle.write() to display information on the turtle canvas.
|
Issued stock dividends during the current period
: For this discussion, assume the role of an investor. How would you know whether the company you are considering to invest in has repurchased any of its own stock and/or issued stock dividends during the current period? Why is this important, and woul..
|
FIFO-LIFO and weighted average methods
: Net income results, reported in the financial statement presentation, can be affected by the inventory reporting methods used. FIFO, LIFO, and weighted average methods each have their own implications during periods of inflation and deflation. Consid..
|
Calculate the rate at which firm can grow without changing
: Calculate the rate at which a firm can grow without changing its leverage if its payout ratio is 75%, equity outstanding at the beginning of the year is $970,000, and its net income for the year is $157,000. What is the WACC for a firm with 45% debt ..
|
Description of quantitative methods
: Description of quantitative method(s). Justify why you utilized this statistical method for your study. Analysis of the data (Discuss your results and include a separate sheet that shows your quantitative results in tabular or graphical form)
|