Nickleaton / sudoku

0 stars 0 forks source link

Hot and Cold Cages #248

Open Nickleaton opened 1 year ago

Nickleaton commented 1 year ago

https://app.crackingthecryptic.com/sudoku/jPmjLqHfbp

Hot and Cold Cages by Bren77 Normal sudoku rules apply. In every row, column and 3x3 box there is exactly one 'hot' cell (which has a value one greater than its digit) and exactly one 'cold' cell (which has a value one less than its digit). Each digit 1 to 9 appears in exactly one hot cell and in exactly one cold cell. Values in cages sum to the clue if given. Digits cannot repeat within a cage, though values may. [Cages without clues make a symmetric pattern and are given purely for aesthetic reasons.]

Nickleaton commented 1 year ago

0/1 for hot, 0/1 for cold.

Sum hot or cold by box, row and col = 1 gives one per row, box, column

There is also the restriction that hot digits must be unique, same for cold. so treat it like an extra region. For each cell, 9 0/1 variables. So if Hot(1,1,4) == 1 then cell 1,1 contains a 4 and is hot. Only 9 hot cells allowed. Uniqueness easy to implement.

The for value of the cell, subtract the cold var and add the hot, solve as normal.