@@ -19,16 +19,6 @@ specs = do
1919 , " W W "
2020 , " W " ]
2121
22- board9x9 = [ " B B "
23- , " B B B"
24- , " WBBBWBBBW"
25- , " W W W W W"
26- , " "
27- , " W W W W "
28- , " B B B B"
29- , " W BBB W "
30- , " B B " ]
31-
3222 shouldHaveTerritories = shouldMatchList
3323 . map (first toAscList)
3424 . territories
@@ -54,33 +44,39 @@ specs = do
5444 , ([ (4 , 1 )
5545 , (4 , 2 ) ], Just White ) ]
5646
47+ it " two territories of same player, rectangular board" $
48+ [ " B " ] `shouldHaveTerritories` [ ([ (1 , 1 ) ], Just Black )
49+ , ([ (3 , 1 ) ], Just Black ) ]
50+
5751 it " 5x5 score" $
5852 board5x5 `shouldScore` [ (Nothing , 9 )
5953 , (Just Black , 6 )
6054 , (Just White , 1 ) ]
6155
62- it " 5x5 territory for black" $
56+ it " 5x5 territory for black bordering edge " $
6357 territoryIn board5x5 (1 , 2 ) `shouldBe` Just ([ (1 , 1 )
6458 , (1 , 2 )
6559 , (2 , 1 ) ], Just Black )
6660
67- it " 5x5 territory for white" $
61+ it " 5x5 territory for white not bordering edge " $
6862 territoryIn board5x5 (3 , 4 ) `shouldBe` Just ([ (3 , 4 ) ], Just White )
6963
70- it " 5x5 open territory" $
64+ it " 5x5 open territory bordering edge " $
7165 territoryIn board5x5 (2 , 5 ) `shouldBe` Just ([ (1 , 4 )
7266 , (1 , 5 )
7367 , (2 , 5 ) ], Nothing )
7468
7569 it " 5x5 non-territory (stone)" $
7670 territoryIn board5x5 (2 , 2 ) `shouldBe` Nothing
7771
78- it " 5x5 non-territory (too low coordinate )" $
72+ it " 5x5 non-territory (X too low)" $
7973 territoryIn board5x5 (0 , 2 ) `shouldBe` Nothing
8074
81- it " 5x5 non-territory (too high coordinate )" $
82- territoryIn board5x5 (2 , 6 ) `shouldBe` Nothing
75+ it " 5x5 non-territory (X too high)" $
76+ territoryIn board5x5 (6 , 2 ) `shouldBe` Nothing
8377
84- it " 9x9 score" $
85- board9x9 `shouldScore` [ (Nothing , 33 )
86- , (Just Black , 14 ) ]
78+ it " 5x5 non-territory (Y too low)" $
79+ territoryIn board5x5 (2 , 0 ) `shouldBe` Nothing
80+
81+ it " 5x5 non-territory (Y too high)" $
82+ territoryIn board5x5 (2 , 6 ) `shouldBe` Nothing
0 commit comments