File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,34 @@ def test_swordfish_synthetic_single_elimination() -> None:
2020 assert digit not in cand [move ["r" ]][move ["c" ]]
2121
2222
23+ def test_swordfish_col_eliminates_extra_row_candidate () -> None :
24+ grid = [[0 ] * 9 for _ in range (9 )]
25+ cand = candidates (grid )
26+ digit = 7
27+ rows = [0 , 4 , 8 ]
28+ cols = [1 , 4 , 7 ]
29+
30+ for r in range (9 ):
31+ for c in range (9 ):
32+ cand [r ][c ].discard (digit )
33+
34+ for c in cols :
35+ for r in rows :
36+ cand [r ][c ].add (digit )
37+
38+ target_row = rows [0 ]
39+ target_col = 0
40+ cand [target_row ][target_col ].add (digit )
41+
42+ move = apply_swordfish (grid , cand )
43+
44+ assert move is not None
45+ assert move ["strategy" ] == "swordfish_col"
46+ assert move ["digit" ] == digit
47+ assert (move ["r" ], move ["c" ]) == (target_row , target_col )
48+ assert digit not in cand [target_row ][target_col ]
49+
50+
2351def test_simple_coloring_one_elimination () -> None :
2452 grid = [[0 ] * 9 for _ in range (9 )]
2553 cand = candidates (grid )
You can’t perform that action at this time.
0 commit comments