My following question regards a problem I am having remembering python code. It has been about a year and a half since I last opened the shell or wrote any sort of code. I am attempting to rewrite the bullseye program that was seen in the Greater New York Programming Contest (year 2004 I believe). Here is the link if anyone is interested in re-writting or tweaking some neat programs I am told that the region between each pair of rings (or the center and the first ring) represents a certain point value. The closer the region is to the center of the dartboard, the more points the region is worth (as a normal dartboard is). I have decided to make the ring radii at 3" 6" 9" 12" and 15", while the bullseye is 6" in diameter.
So now is where the fun starts.
I want to create the program so when it runs, the first player throws 3 darts and the score is tallied up. The darts are then removed and the 2nd player repeats the process. At the end I will have it read something such as
SCORE: N to M, Player P win (or state if it is a tie). I am making N player 1's score and M player 2's score. However I am a bit confused on the next part of the instructions which state:
That a text file (games.txt) will contain one or more datasets
"A dataset is a line with 12 float values separated by spaces. Each pair of values represents the X and Y distances respectively of a dart from the center of the board in inches. (the center is located at X = 0, Y = 0. The range of values are:
−20.0 <= X, Y <= 20.0. Player one’s darts are represented by the first 3 pairs of values, and player two’s by the last 3 pairs of values. Input is terminated by the first value of a dataset being -100."
I am not asking for someone to write this up for me because I would like to try it myself, but that last part has me a bit confused. I am fuzzy on what exactly that last part means. If perhaps someone can explain it?
Also I decided to use a function such as score(x,y) which will return the score of a dart thrown at the coordinates(x,y). What I mean by this is something like: score(0,0) would be a bullseye for 100 points while score(-9,0) would hit the 3rd ring for 60 points.
Does that function seem reasonable to use? Thats what Ive come up with so far, I will continue posting my progress as I receive feedback. Any help, suggestions, comments would be greatly appreciated. Thank you for your time.