* set correct canonical data version * adapt tests and example solution to canonical data 1.0.0 * use assertSetEqual() consistently
40 lines
1.0 KiB
Python
40 lines
1.0 KiB
Python
|
|
class Board:
|
|
"""Count territories of each player in a Go game
|
|
|
|
Args:
|
|
board (list[str]): A two-dimensional Go board
|
|
"""
|
|
|
|
def __init__(self, board):
|
|
pass
|
|
|
|
def territory(self, x, y):
|
|
"""Find the owner and the territories given a coordinate on
|
|
the board
|
|
|
|
Args:
|
|
x (int): Column on the board
|
|
y (int): Row on the board
|
|
|
|
Returns:
|
|
(str, set): A tuple, the first element being the owner
|
|
of that area. One of "W", "B", "". The
|
|
second being a set of coordinates, representing
|
|
the owner's territories.
|
|
"""
|
|
pass
|
|
|
|
def territories(self):
|
|
"""Find the owners and the territories of the whole board
|
|
|
|
Args:
|
|
none
|
|
|
|
Returns:
|
|
dict(str, set): A dictionary whose key being the owner
|
|
, i.e. "W", "B", "". The value being a set
|
|
of coordinates owned by the owner.
|
|
"""
|
|
pass
|