From f4e4461294134cd0bf48c58bcff6f49e9c379d2c Mon Sep 17 00:00:00 2001 From: Ian Whitney Date: Thu, 20 Oct 2016 21:12:45 -0500 Subject: [PATCH 1/3] 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. --- exercises/bowling/canonical-data.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exercises/bowling/canonical-data.json b/exercises/bowling/canonical-data.json index 20b9b56a64..9ecf554f3a 100644 --- a/exercises/bowling/canonical-data.json +++ b/exercises/bowling/canonical-data.json @@ -89,6 +89,10 @@ "description": "Two bonus rolls after a strike in the last frame can not score more than 10 points", "rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5, 6], "expected": -1 + }, { + "description": "Two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike", + "rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6], + "expected": 26 }, { "description": "An unstarted game can not be scored", "rolls": [], From bf871954ac68a66f01e540a94abef572ef22db8f Mon Sep 17 00:00:00 2001 From: Ian Whitney Date: Fri, 21 Oct 2016 07:10:47 -0500 Subject: [PATCH 2/3] 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. https://github.com/exercism/x-common/pull/418#issuecomment-255315518 . --- exercises/bowling/canonical-data.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exercises/bowling/canonical-data.json b/exercises/bowling/canonical-data.json index 9ecf554f3a..19b5404767 100644 --- a/exercises/bowling/canonical-data.json +++ b/exercises/bowling/canonical-data.json @@ -93,6 +93,10 @@ "description": "Two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike", "rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6], "expected": 26 + }, { + "description": "The second bonus rolls after a strike in the last frame can not be a strike if the first one is not a strike", + "rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6, 10], + "expected": -1 }, { "description": "An unstarted game can not be scored", "rolls": [], From aba129236210c1adf6e8112b23b0553c6384e72b Mon Sep 17 00:00:00 2001 From: Ian Whitney Date: Fri, 21 Oct 2016 17:37:35 -0500 Subject: [PATCH 3/3] Lowercasing --- exercises/bowling/canonical-data.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/exercises/bowling/canonical-data.json b/exercises/bowling/canonical-data.json index 19b5404767..32aa0c0867 100644 --- a/exercises/bowling/canonical-data.json +++ b/exercises/bowling/canonical-data.json @@ -15,7 +15,7 @@ ], "score": { "description": [ - "Returns the final score of a bowling game" + "returns the final score of a bowling game" ], "cases": [{ "description": "should be able to score a game with all zeros", @@ -74,39 +74,39 @@ "rolls": [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10], "expected": 300 }, { - "description": "Rolls can not score negative points", + "description": "rolls can not score negative points", "rolls": [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "expected": -1 }, { - "description": "A roll can not score more than 10 points", + "description": "a roll can not score more than 10 points", "rolls": [11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "expected": -1 }, { - "description": "Two rolls in a frame can not score more than 10 points", + "description": "two rolls in a frame can not score more than 10 points", "rolls": [5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "expected": -1 }, { - "description": "Two bonus rolls after a strike in the last frame can not score more than 10 points", + "description": "two bonus rolls after a strike in the last frame can not score more than 10 points", "rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5, 6], "expected": -1 }, { - "description": "Two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike", + "description": "two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike", "rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6], "expected": 26 }, { - "description": "The second bonus rolls after a strike in the last frame can not be a strike if the first one is not a strike", + "description": "the second bonus rolls after a strike in the last frame can not be a strike if the first one is not a strike", "rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6, 10], "expected": -1 }, { - "description": "An unstarted game can not be scored", + "description": "an unstarted game can not be scored", "rolls": [], "expected": -1 }, { - "description": "An incomplete game can not be scored", + "description": "an incomplete game can not be scored", "rolls": [0, 0], "expected": -1 }, { - "description": "A game with more than ten frames can not be scored", + "description": "a game with more than ten frames can not be scored", "rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "expected": -1 }, {