5 kyu
Bowling score calculator
633 of 1,540tpatja
Loading description...
Games
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Great kata of the bowling series, well done.
Python, JavaScript, and CoffeeScript sample tests are using
Test.expect
.Fixed.
No random tests in Python, JavaScript, and CoffeeScript.
I don't understand the the 190 test case. It has 10 [9,1] scores, so it is 10 consecutive spares. The first one is the only one that is not doubled, so it sums up to 190. But the extra ball is a 9. Isn't the answer 199 instead of 190 for this specific case? (I was doing it in Python)
Note that it has only 10 frames... first 9 frames can contain 1 or 2 ball and last one contain 2 or 3 balls so code accordingly..
and dont raise issue...read description carefully...
let me know if you are not clear
I am still confused too like vmunhoz is.
you get the 10 10 scores and then add the score for the next round for each that would total 10*9 and then there was a 9 for the 3rd ball for the 10th round. It all adds up to 100 + 90 + 9 = 199
Rust translation kumited .
This comment has been hidden.
needs random tests in python too, at least, but I guess that applies to all languages.
Fixed for Haskell.
Swift version kumited. Please review and approve if acceptable.
Ruby and Crystal translations kumited :)
FYI: Submit button not enabled in Firefox 46.0 on Ubuntu 14.4.3 64bit. Works fine in Chromium 49.0.2623.108 same machine.
Not a kata issue.
I have tested my code on my system as well as by printing on codewar's console. I am getting the expected value of the given test cases but it raises value not expected error. Is it something related to time constraint?
I have published a clojure translation. Can some1 approve plz :)
This comment has been hidden.
Test case is too complete. Maybe just put 2 test there, i think it will be better
Describe rules for the 10th frame and give some examples of calculations (e. g., how to earn 300 points). It is very hard to understand rules from your description.
I suggest the following addition to the description:
Ok, as no one replied, I modified the description as a contributor. Can you please take a look and if satisfied, mark this issue as resolved?
Looks good to me. Sorry about the late reply. Resolved.
I didn't understand from the description that a strike in the last frame gives you two extra rolls, and I didn't get that extra balls only count once. The default test cases where helpful, though
Those rules for the last frame are crazy. They must be explained very carefully and precisely.
This comment has been hidden.
That was fun!
You should use test.assert_equals instead of test.expect when comparing two values (and always add error messages!)
typos in the name of the function and in the test, one "test" in writen "text"
In Python function is named
bowling()
and tests callbowling_score()
Second test call has typo: it says 'text' instead of 'test'Fixed. Thanks.
One of the tests uses the module "Text" instead of "Test" It would be better to use Test.assert_equals and to add some error message.
The instructions are not clear for someone who has not played bowling before. Specifically, I could not figure out how 2 or 3 balls are chosen in the 10th frame, and had to go spend a half hour looking up rules.
I suggest adding something like this:
This was rather frustrating to deal with, and has nothing to do with programming.
the rules given by instructions is not so clear! About the last frame
Thank you for the feedback.
What would you add to the instructions about the last frame?
Needs more explanation of the last frame being a strike or a spare
In the last (10th) frame, the player rolls 2 or 3 balls. If the player knocks down all the pins with the first or second roll, he gets a third roll. The maximum the player can get in the 10th frame is 3 strikes. The minimum is 0 (2 rolls with no pins knocked down). HTH.
Is it possible to roll just one ball in the final frame?
No. In the 10th frame the player rolls 2 or 3 balls.
Good catch, I'll update the instructions.
This comment has been hidden.
Yeah, not obvious indeed.
I don't want to spoil the fun of solving, but here is a tip: the bonus gets added only if there is a next frame.
Definitely needs more test case examples. This kata is all about the corner cases. Nice excercise though, it's deceptively hard!
The main tests should be complete and there should be no edge cases that are not covered.
What test cases do you think should be added to the test case examples?
Test case examples added for all languages. Please resolve.
I agree with bartavelle that the ending frame is a bit unclear. I had to play around with a few online bowling score apps to figure out how it works (and they weren't all consistent!). This is exactly what test cases are for.
More example test cases added for all languages.
Finally! I was wondering when this would show up on the website.
Every software firm in Chicago seemingly uses this as its interview question.
Great exercise.
Thank you.