From 56c7a3dc8409009351ce546d3aac2c22b4894a8a Mon Sep 17 00:00:00 2001 From: Jeffrey Sander Date: Fri, 23 Feb 2018 15:53:53 -0500 Subject: [PATCH 1/2] go-counting: Add single-territory function to README All implementing tracks have this function, but it is never mentioned. --- exercises/go-counting/description.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exercises/go-counting/description.md b/exercises/go-counting/description.md index 6127207b4f..4e5c012f09 100644 --- a/exercises/go-counting/description.md +++ b/exercises/go-counting/description.md @@ -9,6 +9,8 @@ Write a function that determines the territory of each player. You may assume that any stones that have been stranded in enemy territory have already been taken off the board. +Write a function that determines the territory which includes a specified coordinate. + Multiple empty intersections may be encircled at once and for encircling only horizontal and vertical neighbours count. In the following diagram the stones which matter are marked "O" and the stones that don't are From 9fd878993307fd50148f7a5e7c3d7947e915c938 Mon Sep 17 00:00:00 2001 From: Jeffrey Sander Date: Thu, 22 Feb 2018 15:28:10 -0500 Subject: [PATCH 2/2] go-counting: Add canonical data file Closes https://github.com/exercism/problem-specifications/issues/560 Implementing tracks (4): * https://github.com/exercism/csharp/tree/master/exercises/go-counting * https://github.com/exercism/fsharp/tree/master/exercises/go-counting * https://github.com/exercism/haskell/tree/master/exercises/go-counting * https://github.com/exercism/python/tree/master/exercises/go-counting --- exercises/go-counting/canonical-data.json | 200 ++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 exercises/go-counting/canonical-data.json diff --git a/exercises/go-counting/canonical-data.json b/exercises/go-counting/canonical-data.json new file mode 100644 index 0000000000..a2e0efd7c0 --- /dev/null +++ b/exercises/go-counting/canonical-data.json @@ -0,0 +1,200 @@ +{ + "exercise": "go-counting", + "version": "1.0.0", + "comments": [ + "Territory consists of [x, y] coordinate pairs." + ], + "cases": [ + { + "description": "Black corner territory on 5x5 board", + "property": "territory", + "input": { + "board": [ + " B ", + " B B ", + "B W B", + " W W ", + " W " + ], + "x": 0, + "y": 1 + }, + "expected": { + "owner": "BLACK", + "territory": [[0, 0], [0, 1], [1, 0]] + } + }, + { + "description": "White center territory on 5x5 board", + "property": "territory", + "input": { + "board": [ + " B ", + " B B ", + "B W B", + " W W ", + " W " + ], + "x": 2, + "y": 3 + }, + "expected": { + "owner": "WHITE", + "territory": [[2, 3]] + } + }, + { + "description": "Open corner territory on 5x5 board", + "property": "territory", + "input": { + "board": [ + " B ", + " B B ", + "B W B", + " W W ", + " W " + ], + "x": 1, + "y": 4 + }, + "expected": { + "owner": "NONE", + "territory": [[0, 3], [0, 4], [1, 4]] + } + }, + { + "description": "A stone and not a territory on 5x5 board", + "property": "territory", + "input": { + "board": [ + " B ", + " B B ", + "B W B", + " W W ", + " W " + ], + "x": 1, + "y": 1 + }, + "expected": { + "owner": "NONE", + "territory": [] + } + }, + { + "description": "Invalid because X is too low for 5x5 board", + "property": "territory", + "input": { + "board": [ + " B ", + " B B ", + "B W B", + " W W ", + " W " + ], + "x": -1, + "y": 1 + }, + "expected": { + "error": "Invalid coordinate" + } + }, + { + "description": "Invalid because X is too high for 5x5 board", + "property": "territory", + "input": { + "board": [ + " B ", + " B B ", + "B W B", + " W W ", + " W " + ], + "x": 5, + "y": 1 + }, + "expected": { + "error": "Invalid coordinate" + } + }, + { + "description": "Invalid because Y is too low for 5x5 board", + "property": "territory", + "input": { + "board": [ + " B ", + " B B ", + "B W B", + " W W ", + " W " + ], + "x": 1, + "y": -1 + }, + "expected": { + "error": "Invalid coordinate" + } + }, + { + "description": "Invalid because Y is too high for 5x5 board", + "property": "territory", + "input": { + "board": [ + " B ", + " B B ", + "B W B", + " W W ", + " W " + ], + "x": 1, + "y": 5 + }, + "expected": { + "error": "Invalid coordinate" + } + }, + { + "description": "One territory is the whole board", + "property": "territories", + "input": { + "board": [ + " " + ] + }, + "expected": { + "territoryBlack": [], + "territoryWhite": [], + "territoryNone": [[0, 0]] + } + }, + { + "description": "Two territory rectangular board", + "property": "territories", + "input": { + "board": [ + " BW ", + " BW " + ] + }, + "expected": { + "territoryBlack": [[0, 0], [0, 1]], + "territoryWhite": [[3, 0], [3, 1]], + "territoryNone": [] + } + }, + { + "description": "Two region rectangular board", + "property": "territories", + "input": { + "board": [ + " B " + ] + }, + "expected": { + "territoryBlack": [[0, 0], [2, 0]], + "territoryWhite": [], + "territoryNone": [] + } + } + ] +}