Skip to content

[Bowling] Add edge case with fill balls in a last-frame strike #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 22, 2016

Conversation

IanWhitney
Copy link
Contributor

The previous test does not quite capture the behavior.

If the first fill fill is a non-strikes, then the total fill-ball score
must be less than 10.

But, if the first fill ball is a strike, then the total fill-ball score
must be less than 20. Because that first fill-ball strike resets the
pins.

I had what I thought was a working implementation but it totally missed
the 2nd case. Adding a test to cover that case.

The previous test does not quite capture the behavior.

If the first fill fill is a non-strikes, then the total fill-ball score
must be less than 10.

But, if the first fill ball is a strike, then the total fill-ball score
must be less than 20. Because that first fill-ball strike resets the
pins.

I had what I thought was a working implementation but it totally missed
the 2nd case. Adding a test to cover that case.
@IanWhitney
Copy link
Contributor Author

I'm also wondering about adding

 }, {
      "description": "Two bonus rolls after a strike in the last frame can have a strike on the second roll",
      "rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6, 10],
      "expected": -1

To check for logic that looks for either of the fill balls being == 10 and then checking that the fill score is <= 20

IanWhitney pushed a commit to IanWhitney/xrust that referenced this pull request Oct 21, 2016
Based on exercism/problem-specifications#418

These tests should capture all of the edge cases of validating the two
balls that can come after a strike in the final frame
@IanWhitney IanWhitney mentioned this pull request Oct 21, 2016
5 tasks
@Insti Insti changed the title Add edge case with fill balls in a last-frame strike [Bowling] Add edge case with fill balls in a last-frame strike Oct 21, 2016
@petertseng
Copy link
Member

Case that is currently added 10, 10, 6 seems good.

You might think 10, 6, 10 seems to overlap with our existing 10, 5, 6, so it would only fail if someone is special-casing 10. Admittedly, someone might, given the before test. Given that we can think of an implementation that would fail it that it seems like someone could write, seems good to add it, I think.

This test checks that the fill balls validate correctly if the 2nd ball
is a strike.
exercism#418 (comment)
.
@IanWhitney
Copy link
Contributor Author

10,6,10 definitely failed for me. I had some code that checked if any of the fill balls were a 10. And if so, it checked that the total of the fill balls was less than 20. That was incorrect.

@Insti
Copy link
Contributor

Insti commented Oct 21, 2016

Both these new tests seem reasonable. 👍

@Insti
Copy link
Contributor

Insti commented Oct 21, 2016

The new descriptions are capitalised which conflicts with the lowercase standardisation requested by #416.

@Insti
Copy link
Contributor

Insti commented Oct 22, 2016

Oh dear I've made a mess of this 😢 sorry!

@Insti
Copy link
Contributor

Insti commented Oct 22, 2016

@IanWhitney can you make another PR for this? I can't work out how to re-apply this PR through github.

I merged this PR, then saw that it caused #416 to have conflicts and thought if I merged that one first I could merge this one without conflicts, so I reverted this merge and applied #416 but now I cant seem to re-apply this one.

Insti pushed a commit to Insti/x-common that referenced this pull request Oct 22, 2016
…ism#418)

* Add edge case with fill balls in a last-frame strike

The previous test does not quite capture the behavior.

If the first fill fill is a non-strikes, then the total fill-ball score
must be less than 10.

But, if the first fill ball is a strike, then the total fill-ball score
must be less than 20. Because that first fill-ball strike resets the
pins.

I had what I thought was a working implementation but it totally missed
the 2nd case. Adding a test to cover that case.

* Add edge case test for final-strike fill balls

This test checks that the fill balls validate correctly if the 2nd ball
is a strike.
Insti added a commit that referenced this pull request Oct 22, 2016
…#423)

* Add edge case with fill balls in a last-frame strike

The previous test does not quite capture the behavior.

If the first fill fill is a non-strikes, then the total fill-ball score
must be less than 10.

But, if the first fill ball is a strike, then the total fill-ball score
must be less than 20. Because that first fill-ball strike resets the
pins.

I had what I thought was a working implementation but it totally missed
the 2nd case. Adding a test to cover that case.

* Add edge case test for final-strike fill balls

This test checks that the fill balls validate correctly if the 2nd ball
is a strike.
@Insti
Copy link
Contributor

Insti commented Oct 22, 2016

I think I've recovered this now, and don't need @IanWhitney to make another PR.

Sorry everyone for the trouble. ☹️

IanWhitney pushed a commit to IanWhitney/xrust that referenced this pull request Oct 26, 2016
Based on exercism/problem-specifications#418

These tests should capture all of the edge cases of validating the two
balls that can come after a strike in the final frame
@IanWhitney IanWhitney deleted the add_edge_case_to_bowling_tests branch October 26, 2016 00:40
emcoding pushed a commit that referenced this pull request Nov 19, 2018
* Use % for all expected arrays

* Use symbols in all scale names

* Add BookKeeping::VERSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants