-
-
Notifications
You must be signed in to change notification settings - Fork 555
go-counting: Add single-territory function to README; Add canonical data #1195
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks good, thanks for making this change. |
||
"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]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Same, but for no owner |
||
} | ||
}, | ||
{ | ||
"description": "Two territory rectangular board", | ||
"property": "territories", | ||
"input": { | ||
"board": [ | ||
" BW ", | ||
" BW " | ||
] | ||
}, | ||
"expected": { | ||
"territoryBlack": [[0, 0], [0, 1]], | ||
"territoryWhite": [[3, 0], [3, 1]], | ||
"territoryNone": [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Same, but for no owner |
||
} | ||
}, | ||
{ | ||
"description": "Two region rectangular board", | ||
"property": "territories", | ||
"input": { | ||
"board": [ | ||
" B " | ||
] | ||
}, | ||
"expected": { | ||
"territoryBlack": [[0, 0], [2, 0]], | ||
"territoryWhite": [], | ||
"territoryNone": [] | ||
} | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jssander @petertseng I know this PR has already been merged, but should this be "A stone is not a territory..."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want. I admit I don't see a reason to prefer one or the other, but that could just be because of English not being my first language. I'm happy to defer to others on this matter.