-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtest_goban.py
61 lines (46 loc) · 1.19 KB
/
test_goban.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from goban import Goban
def test_white_is_taken_when_surrounded_by_black() -> None:
goban = Goban([
'.#.',
'#o#',
'.#.',
])
assert goban.is_taken(1, 1) is True
def test_white_is_not_taken_when_it_has_a_liberty() -> None:
goban = Goban([
'...',
'#o#',
'.#.',
])
assert goban.is_taken(1, 1) is False
def test_black_shape_is_taken_when_surrounded() -> None:
goban = Goban([
'oo.',
'##o',
'o#o',
'.o.',
])
assert goban.is_taken(0, 1) is True
assert goban.is_taken(1, 1) is True
assert goban.is_taken(1, 2) is True
def test_black_shape_is_not_taken_when_it_has_a_liberty() -> None:
goban = Goban([
'oo.',
'##.',
'o#o',
'.o.',
])
assert goban.is_taken(0, 1) is False
assert goban.is_taken(1, 1) is False
assert goban.is_taken(1, 2) is False
def test_square_shape_is_taken() -> None:
goban = Goban([
'oo.',
'##o',
'##o',
'oo.',
])
assert goban.is_taken(0, 1) is True
assert goban.is_taken(0, 2) is True
assert goban.is_taken(1, 1) is True
assert goban.is_taken(1, 2) is True