Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
You're correct - that is contradictory. I've corrected the problem statement to be consistent with actual baseball rules. i.e. that the runner on 2nd will not advance unless he is 'forced' i.e. a runner on first pushes him.
Thanks for spotting that.
I had no understanding of baseball scoring before this kata so it is very possible that I'm misreading/misinterpreting the kata description. I am confused by two seemingly contradictory statements in the description.
Under "Subsequent Batters":
However in the example:
There was no one on 1st base before the walk began, yet the runner on 2nd base advanced. So which one is correct? This is unclear to me.
It looks fixed now. Probably when the issue was posted it was still running an old version of text fixture. (This actually happens fairly often ;-))
Could you offer me an example? I'm unsure how this could be exploited.
Fair point, have added an explicit test.
Added additional random tests with better distribution i.e. a S happens more than a hit etc
Tests are very weak on the handling on
F
. Not correctly handlingF
at 2 strikes still passes the random tests fairly often.Note: in Ruby, strings are mutable.
Alternatively, compute expected value before actual value (and make sure the reference solution don't mutate the input).
This comment is hidden because it contains spoiler information about the solution
Thank you, again.
Very specific edge case caused by a typo. Added as specific test.
This comment is hidden because it contains spoiler information about the solution
Thank you. Resolved.
From random tests: