@@ -66,3 +66,52 @@ def test_simple_coloring_one_elimination() -> None:
6666 assert move ["strategy" ] == "simple_coloring"
6767 assert move ["digit" ] == digit
6868 assert digit not in cand [move ["r" ]][move ["c" ]]
69+
70+
71+ def test_simple_coloring_reports_row_conflict_metadata () -> None :
72+ grid = [[0 ] * 9 for _ in range (9 )]
73+ cand = candidates (grid )
74+ digit = 4
75+
76+ for r in range (9 ):
77+ for c in range (9 ):
78+ cand [r ][c ].discard (digit )
79+
80+ # Build a coloring component where two same-colored nodes share row 1.
81+ # Row 1 contains three candidates so no conjugate link is created there.
82+ pattern = [(1 , 1 ), (4 , 1 ), (4 , 7 ), (2 , 7 ), (1 , 8 ), (1 , 4 )]
83+ for r , c in pattern :
84+ cand [r ][c ].add (digit )
85+
86+ move = apply_simple_coloring (grid , cand )
87+ assert move is not None
88+ assert move ["strategy" ] == "simple_coloring"
89+ assert move ["digit" ] == digit
90+ assert move ["unit" ] == "row"
91+ assert move ["unit_index" ] == 1
92+ assert (move ["r" ], move ["c" ]) == (1 , 1 )
93+ assert digit not in cand [1 ][1 ]
94+
95+
96+ def test_simple_coloring_reports_column_conflict_metadata () -> None :
97+ grid = [[0 ] * 9 for _ in range (9 )]
98+ cand = candidates (grid )
99+ digit = 6
100+
101+ for r in range (9 ):
102+ for c in range (9 ):
103+ cand [r ][c ].discard (digit )
104+
105+ # Analogous setup forcing two same-colored nodes to appear in column 1.
106+ pattern = [(1 , 1 ), (1 , 4 ), (7 , 4 ), (7 , 2 ), (8 , 1 ), (4 , 1 )]
107+ for r , c in pattern :
108+ cand [r ][c ].add (digit )
109+
110+ move = apply_simple_coloring (grid , cand )
111+ assert move is not None
112+ assert move ["strategy" ] == "simple_coloring"
113+ assert move ["digit" ] == digit
114+ assert move ["unit" ] == "col"
115+ assert move ["unit_index" ] == 1
116+ assert (move ["r" ], move ["c" ]) == (1 , 1 )
117+ assert digit not in cand [1 ][1 ]
0 commit comments