Killer cage
Cage digits add up to the stated total value. Digits are different unless repeats are allowed. A cage without a total supplies the repeat rule alone.
Parameters
| Parameter | Meaning | Default |
|---|---|---|
| cells | The marked cells, for example r1c1-r1c2-r2c2. | Required. |
| total | The total the digits or values must add up to. | No total imposed. |
| repeats | Whether repeated digits are allowed. | false (distinct digits). |
Maths
Class: with aggregates.
The shared predicates define the notation and every named predicate.
(¬repeats → distinct_D(cells)) ∧ (present(total) → valueSum(cells)=unwrap(total))
Digits differ unless repeats are allowed; when a total is supplied, the cage values add up to it.
Example
---
format: open-rules
title: Killer cage example
setter: Example
source: ""
case: ""
library: https://rules.sudoku-sleuth.com/
status: read
---
```rules
sudoku 9x9
cage r1c1-r1c2 total 3
```
Satisfies the rule: r1c1=1, r1c2=2. The different digits 1 and 2 total 3.
Breaks the rule: r1c1=1, r1c2=3. The digits 1 and 3 total 4 instead of 3.