Skip to content

Commit d1ac9da

Browse files
authored
Merge pull request #10 from imattman/bowling-clarification
Clarification and example output of bowling challenge
2 parents 2d6ac50 + d9362ee commit d1ac9da

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

05-bowling-scores/README.md

+35-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ The league captain diligently tracked player scores each week in a mobile app on
66

77
However, three challenges exist:
88

9-
1. The phone app is limited to exporting JSON data but the web application only supports importing CSV data.
9+
1. The phone app is limited to exporting JSON data but the web application only supports importing CSV data, and organized differently (see below).
1010
2. The JSON data uses bowling codes (e.g. `'X'` for denoting a strike) however the CVS import only supports numeric values.
1111
3. The league captain doesn't quite trust the website operator and would like you to compute game scores and player season averages that she can verify the website against later.
1212

13-
## Some Tips on the Data
13+
## Some Tips on the JSON Data
1414

1515
- A player game is represented as a list of 10 sublists:
1616
- The 10 sublists represent the 10 frames of a bowling game.
@@ -22,6 +22,39 @@ However, three challenges exist:
2222
- `'-'` is a miss of all pins (either roll)
2323
- Each player bowled 3 games per week played. If a member didn't play a particular night, all game data for that night is replaced by the string `"absent"`. The JSON data reflects these weekly groups of three games, however that grouping structure is not needed for the CSV import.
2424

25+
## Expected CSV Data
26+
27+
The CSV importer is finicky and requires the CSV data conform to a particular structure to be processed:
28+
29+
Each player game is represented as a line in the CSV, split into 22-23 cells:
30+
31+
- 1 cell for the player name
32+
- 18 cells for the first 9 frames, with a cell for each of the 2 rolls per frame
33+
- 3 cells for the 10th frame with a possible 3 rolls
34+
- 1 cell for the game score (optional)
35+
36+
Cells where a roll is not normally taken should be left blank (e.g. the second roll of a frame after a **strike**).
37+
38+
Rows should be grouped by weekly game instead of by player as they are in the JSON data.
39+
40+
Each new week group should have a header row with the text `"# Week nn"` where _nn_ is the week number starting from a count of `1`.
41+
42+
Blank rows are ignored by the CSV importer and are safe to use to separate weekly data.
43+
44+
Example result:
45+
46+
"# Week 1"
47+
"player 1",3,4,9,1,6,3,7,2,8,1,8,2,7,2,7,3,5,0,6,2,,104
48+
"player 2",6,3,7,2,5,5,4,6,5,3,7,2,7,3,8,1,9,0,9,1,7,117
49+
"player 3",10,,10,,10,,10,,10,,10,,10,,10,,10,,10,10,10,300
50+
"player 1",3,5,7,2,8,2,7,2,6,3,5,5,5,4,7,2,8,1,9,0,,103
51+
"player 2",6,3,7,3,8,1,8,0,7,2,9,1,7,1,6,0,8,0,7,2,,101
52+
"player 3",9,1,8,2,8,1,8,1,7,3,7,2,8,2,8,1,9,0,9,1,9,135
53+
54+
"# Week 2"
55+
"player 1", ...
56+
57+
2558
## Additional Bowling Information
2659

2760
- Full explanation on [keeping score](http://slocums.homestead.com/gamescore.html)

0 commit comments

Comments
 (0)