396 lines
9.4 KiB
Python
396 lines
9.4 KiB
Python
play_tests = [
|
|
|
|
# code, list of moves to play, board representation, simple ko point, score
|
|
|
|
('blank', [
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 . . . . . . . . .
|
|
3 . . . . . . . . .
|
|
2 . . . . . . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 0),
|
|
|
|
('twostone', [
|
|
"B B2", "W C2",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 . . . . . . . . .
|
|
3 . . . . . . . . .
|
|
2 . # o . . . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 0),
|
|
|
|
('many-groups-1-capture', [
|
|
"B C3", "W D3", "B C5", "B C4", "W D4", "B H1", "B B9", "B J6",
|
|
"B A7", "B B7", "W A3", "W J2", "W H2", "W G2", "W J3",
|
|
"B F7",
|
|
"W E6", "W G8", "W G6", "W F8", "W E7", "W F6", "W G7", "W E8",
|
|
], """\
|
|
9 . # . . . . . . .
|
|
8 . . . . o o o . .
|
|
7 # # . . o . o . .
|
|
6 . . . . o o o . #
|
|
5 . . # . . . . . .
|
|
4 . . # o . . . . .
|
|
3 o . # o . . . . o
|
|
2 . . . . . . o o o
|
|
1 . . . . . . . # .
|
|
A B C D E F G H J
|
|
""", None, -8),
|
|
|
|
('corner-bl', [
|
|
"B A1", "W B1", "W A2",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 . . . . . . . . .
|
|
3 . . . . . . . . .
|
|
2 o . . . . . . . .
|
|
1 . o . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, -81),
|
|
|
|
('corner-all', [
|
|
"B A1", "W B1", "W A2",
|
|
"B J1", "W H1", "W J2",
|
|
"B A9", "W B9", "W A8",
|
|
"B J9", "W H9", "W J8",
|
|
], """\
|
|
9 . o . . . . . o .
|
|
8 o . . . . . . . o
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 . . . . . . . . .
|
|
3 . . . . . . . . .
|
|
2 o . . . . . . . o
|
|
1 . o . . . . . o .
|
|
A B C D E F G H J
|
|
""", None, -81),
|
|
|
|
('multiple', [
|
|
"W D4", "B D3", "W C5", "B C4", "W E5", "B E4",
|
|
"B B5", "B F5", "B C6", "B E6", "B D7", "W D6",
|
|
"B D5",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . # . . . . .
|
|
6 . . # . # . . . .
|
|
5 . # . # . # . . .
|
|
4 . . # . # . . . .
|
|
3 . . . # . . . . .
|
|
2 . . . . . . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 81),
|
|
|
|
('large', [
|
|
"W D2", "W G2", "W E3", "W F3", "W F4", "W D5", "W E5", "W F5", "B E2", "B F2",
|
|
"B D3", "B G3", "B D4", "B G4", "B C5", "B G5", "B D6", "B E6", "B F6", "B E4",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . # # # . . .
|
|
5 . . # . . . # . .
|
|
4 . . . # # . # . .
|
|
3 . . . # . . # . .
|
|
2 . . . o # # o . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 16),
|
|
|
|
('pre-recapture', [
|
|
"W A1", "W B1", "W B2", "W C2", "W D3", "W E3", "W A4", "W B4", "W C4", "W E4",
|
|
"B A2", "B D2", "B E2", "B A3", "B B3", "B F3", "B D4", "B F4", "B E5",
|
|
"B C3",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . # . . . .
|
|
4 o o o # . # . . .
|
|
3 # # # . . # . . .
|
|
2 # o o # # . . . .
|
|
1 o o . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 6),
|
|
|
|
('recapture', [
|
|
"W A1", "W B1", "W B2", "W C2", "W D3", "W E3", "W A4", "W B4", "W C4", "W E4",
|
|
"B A2", "B D2", "B E2", "B A3", "B B3", "B F3", "B D4", "B F4", "B E5",
|
|
"B C3", "W D3",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . # . . . .
|
|
4 o o o # . # . . .
|
|
3 . . . o . # . . .
|
|
2 . o o # # . . . .
|
|
1 o o . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, -6),
|
|
|
|
('self-capture-1', [
|
|
"B D4", "B C5", "B E5", "B D6", "W D5",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . # . . . . .
|
|
5 . . # . # . . . .
|
|
4 . . . # . . . . .
|
|
3 . . . . . . . . .
|
|
2 . . . . . . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 81),
|
|
|
|
('self-capture-2', [
|
|
"B D4", "B E4", "B C5", "B F5", "B D6", "B E6", "W D5", "W E5",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . # # . . . .
|
|
5 . . # . . # . . .
|
|
4 . . . # # . . . .
|
|
3 . . . . . . . . .
|
|
2 . . . . . . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 81),
|
|
|
|
('self-capture-3', [
|
|
"B D4", "B E4", "B F4", "B C5", "B G5", "B D6", "B E6", "B F6",
|
|
"W D5", "W F5", "W E5",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . # # # . . .
|
|
5 . . # . . . # . .
|
|
4 . . . # # # . . .
|
|
3 . . . . . . . . .
|
|
2 . . . . . . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 81),
|
|
|
|
('self-capture-many', [
|
|
"B E2", "B D3", "B F3", "B D4", "B F4", "B G4", "B C5", "B H5", "B C6",
|
|
"B F6", "B G6", "B D7", "B E7",
|
|
"W E3", "W E4", "W D5", "W F5", "W G5", "W D6", "W E6", "W E5",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . # # . . . .
|
|
6 . . # . . # # . .
|
|
5 . . # . . . . # .
|
|
4 . . . # . # # . .
|
|
3 . . . # . # . . .
|
|
2 . . . . # . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 81),
|
|
|
|
('ko-corner', [
|
|
"B A1", "B B2", "B A3",
|
|
"W B1", "W A2",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 . . . . . . . . .
|
|
3 # . . . . . . . .
|
|
2 o # . . . . . . .
|
|
1 . o . . . . . . .
|
|
A B C D E F G H J
|
|
""", 'A1', -1),
|
|
|
|
('notko-twocaptured', [
|
|
"B B2", "B B3", "B A4",
|
|
"W B1", "W A2", "W A3",
|
|
"B A1",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 # . . . . . . . .
|
|
3 . # . . . . . . .
|
|
2 . # . . . . . . .
|
|
1 # o . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 5),
|
|
|
|
('notko-tworecaptured', [
|
|
"B A1", "B B3", "B A4",
|
|
"W B1", "W B2", "W A3",
|
|
"B A2",
|
|
], """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 # . . . . . . . .
|
|
3 . # . . . . . . .
|
|
2 # o . . . . . . .
|
|
1 # o . . . . . . .
|
|
A B C D E F G H J
|
|
""", None, 3),
|
|
|
|
]
|
|
|
|
|
|
score_tests = [
|
|
|
|
# code, board representation, score
|
|
|
|
('empty', """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 . . . . . . . . .
|
|
3 . . . . . . . . .
|
|
2 . . . . . . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", 0),
|
|
|
|
('onestone', """\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 . . . . . . . . .
|
|
3 . . . . . . . . .
|
|
2 . # . . . . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", 81),
|
|
|
|
('easy', """\
|
|
9 . . . # o . . . .
|
|
8 . . . # o . . . .
|
|
7 . . . # o . . . .
|
|
6 . . . # o . . . .
|
|
5 . . . # o . . . .
|
|
4 . . . # o . . . .
|
|
3 . . . # o . . . .
|
|
2 . . . # o . . . .
|
|
1 . . . # o . . . .
|
|
A B C D E F G H J
|
|
""", -9),
|
|
|
|
('spoilt', """\
|
|
9 . . . # o . . . .
|
|
8 . . . # o . . . .
|
|
7 . . . # o . . . .
|
|
6 . . . # o . . . .
|
|
5 . . . # o . . # .
|
|
4 . . . # o . . . .
|
|
3 . . . # o . . . .
|
|
2 . . . # o . . . .
|
|
1 . . . # o . . . .
|
|
A B C D E F G H J
|
|
""", 28),
|
|
|
|
('busy', """\
|
|
9 . . o . . o # . #
|
|
8 . o o o o o # . #
|
|
7 . o . o o # # # o
|
|
6 o . o # o # o o o
|
|
5 o o # # # # # o o
|
|
4 . o o # . o # o .
|
|
3 o # # # o o o o o
|
|
2 . o o # # # o o .
|
|
1 o . o # . # o o o
|
|
A B C D E F G H J
|
|
""", -26),
|
|
|
|
]
|
|
|
|
|
|
setup_tests = [
|
|
|
|
# code, black points, white points, empty points, diagram, is_legal
|
|
|
|
('blank',
|
|
[],
|
|
[],
|
|
[],
|
|
"""\
|
|
9 . . . . . . . . .
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 . . . . . . . . .
|
|
3 . . . . . . . . .
|
|
2 . . . . . . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", True),
|
|
|
|
('simple',
|
|
['D4', 'D5'],
|
|
['B1', 'J9'],
|
|
[],
|
|
"""\
|
|
9 . . . . . . . . o
|
|
8 . . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . # . . . . .
|
|
4 . . . # . . . . .
|
|
3 . . . . . . . . .
|
|
2 . . . . . . . . .
|
|
1 . o . . . . . . .
|
|
A B C D E F G H J
|
|
""", True),
|
|
|
|
('illegal',
|
|
['A8', 'B9'],
|
|
['A9'],
|
|
[],
|
|
"""\
|
|
9 . # . . . . . . .
|
|
8 # . . . . . . . .
|
|
7 . . . . . . . . .
|
|
6 . . . . . . . . .
|
|
5 . . . . . . . . .
|
|
4 . . . . . . . . .
|
|
3 . . . . . . . . .
|
|
2 . . . . . . . . .
|
|
1 . . . . . . . . .
|
|
A B C D E F G H J
|
|
""", False),
|
|
|
|
]
|