“Test - Basics 3” => this testcase is looking for an incorrect answer. The testcase thinks that BLACK should be at 22, but the actual answer is 36. Below is the correct answer:
As input, I see 9 rows, 9 columns. After running, black has 4 stones in each row and white has 4, with the middle column neutral. I’m wondering if I’m seeing a different input than you?
Below is what I see for input, and also after running the program:
You didn’t understand the rules properly.
For you, an intersection belongs to black if it’s closer to black than to white.
It’s not the rule.
The rule is: an intersection belongs to black if it’s surrounded by black.
So, as I said above, all central intersections are neutral.
Thanks, now I understand. My code (neutral squares are the squares equidistant from both colors) worked for all the other testcases but only failed for the third testcase. I’m surprised other players didn’t interpret this incorrectly as well, but I have never played GO.
I think the computation for intersecting empty territory is not mentioned clearly. A lot of solvers compute using the nearest black / white bordering piece / only consider horizontal and not vertical borders.
Area scoring: A player’s score is the number of stones that he has on the board, plus the number of empty intersections surrounded by that player’s stones.
should be
Area scoring: A player’s score is the number of stones that he has on the board, plus the number of empty intersections surrounded by that player’s stones ONLY.
Also, the output format should first display BLACK : then WHITE : not the other way around and line count display and better formatting should be used