OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace / tests / query / sudoku-miracle-rules.scm

817 lines · scm ref:
;
; Miracle Sudoku additional rules.
; These extend standard Sudoku with three extra constraints:
;
; 1. Anti-knight: No two cells a knight's move apart can have the same digit
; 2. Anti-king: No two diagonally adjacent cells can have the same digit
; 3. Non-consecutive: No two orthogonally adjacent cells can be consecutive
;
; Load this AFTER sudoku-rules.scm
;
(use-modules (opencog))

; ============================================================
; Non-consecutive predicate (string-based, intentionally ugly)
; Returns #t if the two values are NOT consecutive numbers.
; ============================================================

(define (not-consecutive-strings? a-name b-name)
  "Check if two number-word strings are NOT consecutive.
   Returns #t if they are NOT consecutive, #f if they ARE consecutive."
  (not
    (or
      ; one and two
      (and (string=? a-name "one") (string=? b-name "two"))
      (and (string=? a-name "two") (string=? b-name "one"))
      ; two and three
      (and (string=? a-name "two") (string=? b-name "three"))
      (and (string=? a-name "three") (string=? b-name "two"))
      ; three and four
      (and (string=? a-name "three") (string=? b-name "four"))
      (and (string=? a-name "four") (string=? b-name "three"))
      ; four and five
      (and (string=? a-name "four") (string=? b-name "five"))
      (and (string=? a-name "five") (string=? b-name "four"))
      ; five and six
      (and (string=? a-name "five") (string=? b-name "six"))
      (and (string=? a-name "six") (string=? b-name "five"))
      ; six and seven
      (and (string=? a-name "six") (string=? b-name "seven"))
      (and (string=? a-name "seven") (string=? b-name "six"))
      ; seven and eight
      (and (string=? a-name "seven") (string=? b-name "eight"))
      (and (string=? a-name "eight") (string=? b-name "seven"))
      ; eight and nine
      (and (string=? a-name "eight") (string=? b-name "nine"))
      (and (string=? a-name "nine") (string=? b-name "eight"))
    )))

; Wrapper for use as GroundedPredicate
; Takes a ListLink of two ConceptNodes
(define (not-consecutive? LIST)
  (let* ((outgoing (cog-value->list LIST))
         (a (car outgoing))
         (b (cadr outgoing))
         (a-name (cog-name a))
         (b-name (cog-name b)))
    (not-consecutive-strings? a-name b-name)))

; ============================================================
; Anti-knight constraints
; Cells a knight's move apart must have different values.
; Knight moves: (±1, ±2) and (±2, ±1)
; ============================================================

(define (anti-knight-constraints)
  (list
    ; From row 1
    (ExclusiveLink (Variable "$cell_11") (Variable "$cell_23"))
    (ExclusiveLink (Variable "$cell_11") (Variable "$cell_32"))
    (ExclusiveLink (Variable "$cell_12") (Variable "$cell_24"))
    (ExclusiveLink (Variable "$cell_12") (Variable "$cell_31"))
    (ExclusiveLink (Variable "$cell_12") (Variable "$cell_33"))
    (ExclusiveLink (Variable "$cell_13") (Variable "$cell_21"))
    (ExclusiveLink (Variable "$cell_13") (Variable "$cell_25"))
    (ExclusiveLink (Variable "$cell_13") (Variable "$cell_32"))
    (ExclusiveLink (Variable "$cell_13") (Variable "$cell_34"))
    (ExclusiveLink (Variable "$cell_14") (Variable "$cell_22"))
    (ExclusiveLink (Variable "$cell_14") (Variable "$cell_26"))
    (ExclusiveLink (Variable "$cell_14") (Variable "$cell_33"))
    (ExclusiveLink (Variable "$cell_14") (Variable "$cell_35"))
    (ExclusiveLink (Variable "$cell_15") (Variable "$cell_23"))
    (ExclusiveLink (Variable "$cell_15") (Variable "$cell_27"))
    (ExclusiveLink (Variable "$cell_15") (Variable "$cell_34"))
    (ExclusiveLink (Variable "$cell_15") (Variable "$cell_36"))
    (ExclusiveLink (Variable "$cell_16") (Variable "$cell_24"))
    (ExclusiveLink (Variable "$cell_16") (Variable "$cell_28"))
    (ExclusiveLink (Variable "$cell_16") (Variable "$cell_35"))
    (ExclusiveLink (Variable "$cell_16") (Variable "$cell_37"))
    (ExclusiveLink (Variable "$cell_17") (Variable "$cell_25"))
    (ExclusiveLink (Variable "$cell_17") (Variable "$cell_29"))
    (ExclusiveLink (Variable "$cell_17") (Variable "$cell_36"))
    (ExclusiveLink (Variable "$cell_17") (Variable "$cell_38"))
    (ExclusiveLink (Variable "$cell_18") (Variable "$cell_26"))
    (ExclusiveLink (Variable "$cell_18") (Variable "$cell_37"))
    (ExclusiveLink (Variable "$cell_18") (Variable "$cell_39"))
    (ExclusiveLink (Variable "$cell_19") (Variable "$cell_27"))
    (ExclusiveLink (Variable "$cell_19") (Variable "$cell_38"))

    ; From row 2
    (ExclusiveLink (Variable "$cell_21") (Variable "$cell_33"))
    (ExclusiveLink (Variable "$cell_21") (Variable "$cell_42"))
    (ExclusiveLink (Variable "$cell_22") (Variable "$cell_34"))
    (ExclusiveLink (Variable "$cell_22") (Variable "$cell_41"))
    (ExclusiveLink (Variable "$cell_22") (Variable "$cell_43"))
    (ExclusiveLink (Variable "$cell_23") (Variable "$cell_31"))
    (ExclusiveLink (Variable "$cell_23") (Variable "$cell_35"))
    (ExclusiveLink (Variable "$cell_23") (Variable "$cell_42"))
    (ExclusiveLink (Variable "$cell_23") (Variable "$cell_44"))
    (ExclusiveLink (Variable "$cell_24") (Variable "$cell_32"))
    (ExclusiveLink (Variable "$cell_24") (Variable "$cell_36"))
    (ExclusiveLink (Variable "$cell_24") (Variable "$cell_43"))
    (ExclusiveLink (Variable "$cell_24") (Variable "$cell_45"))
    (ExclusiveLink (Variable "$cell_25") (Variable "$cell_33"))
    (ExclusiveLink (Variable "$cell_25") (Variable "$cell_37"))
    (ExclusiveLink (Variable "$cell_25") (Variable "$cell_44"))
    (ExclusiveLink (Variable "$cell_25") (Variable "$cell_46"))
    (ExclusiveLink (Variable "$cell_26") (Variable "$cell_34"))
    (ExclusiveLink (Variable "$cell_26") (Variable "$cell_38"))
    (ExclusiveLink (Variable "$cell_26") (Variable "$cell_45"))
    (ExclusiveLink (Variable "$cell_26") (Variable "$cell_47"))
    (ExclusiveLink (Variable "$cell_27") (Variable "$cell_35"))
    (ExclusiveLink (Variable "$cell_27") (Variable "$cell_39"))
    (ExclusiveLink (Variable "$cell_27") (Variable "$cell_46"))
    (ExclusiveLink (Variable "$cell_27") (Variable "$cell_48"))
    (ExclusiveLink (Variable "$cell_28") (Variable "$cell_36"))
    (ExclusiveLink (Variable "$cell_28") (Variable "$cell_47"))
    (ExclusiveLink (Variable "$cell_28") (Variable "$cell_49"))
    (ExclusiveLink (Variable "$cell_29") (Variable "$cell_37"))
    (ExclusiveLink (Variable "$cell_29") (Variable "$cell_48"))

    ; From row 3
    (ExclusiveLink (Variable "$cell_31") (Variable "$cell_43"))
    (ExclusiveLink (Variable "$cell_31") (Variable "$cell_52"))
    (ExclusiveLink (Variable "$cell_32") (Variable "$cell_44"))
    (ExclusiveLink (Variable "$cell_32") (Variable "$cell_51"))
    (ExclusiveLink (Variable "$cell_32") (Variable "$cell_53"))
    (ExclusiveLink (Variable "$cell_33") (Variable "$cell_41"))
    (ExclusiveLink (Variable "$cell_33") (Variable "$cell_45"))
    (ExclusiveLink (Variable "$cell_33") (Variable "$cell_52"))
    (ExclusiveLink (Variable "$cell_33") (Variable "$cell_54"))
    (ExclusiveLink (Variable "$cell_34") (Variable "$cell_42"))
    (ExclusiveLink (Variable "$cell_34") (Variable "$cell_46"))
    (ExclusiveLink (Variable "$cell_34") (Variable "$cell_53"))
    (ExclusiveLink (Variable "$cell_34") (Variable "$cell_55"))
    (ExclusiveLink (Variable "$cell_35") (Variable "$cell_43"))
    (ExclusiveLink (Variable "$cell_35") (Variable "$cell_47"))
    (ExclusiveLink (Variable "$cell_35") (Variable "$cell_54"))
    (ExclusiveLink (Variable "$cell_35") (Variable "$cell_56"))
    (ExclusiveLink (Variable "$cell_36") (Variable "$cell_44"))
    (ExclusiveLink (Variable "$cell_36") (Variable "$cell_48"))
    (ExclusiveLink (Variable "$cell_36") (Variable "$cell_55"))
    (ExclusiveLink (Variable "$cell_36") (Variable "$cell_57"))
    (ExclusiveLink (Variable "$cell_37") (Variable "$cell_45"))
    (ExclusiveLink (Variable "$cell_37") (Variable "$cell_49"))
    (ExclusiveLink (Variable "$cell_37") (Variable "$cell_56"))
    (ExclusiveLink (Variable "$cell_37") (Variable "$cell_58"))
    (ExclusiveLink (Variable "$cell_38") (Variable "$cell_46"))
    (ExclusiveLink (Variable "$cell_38") (Variable "$cell_57"))
    (ExclusiveLink (Variable "$cell_38") (Variable "$cell_59"))
    (ExclusiveLink (Variable "$cell_39") (Variable "$cell_47"))
    (ExclusiveLink (Variable "$cell_39") (Variable "$cell_58"))

    ; From row 4
    (ExclusiveLink (Variable "$cell_41") (Variable "$cell_53"))
    (ExclusiveLink (Variable "$cell_41") (Variable "$cell_62"))
    (ExclusiveLink (Variable "$cell_42") (Variable "$cell_54"))
    (ExclusiveLink (Variable "$cell_42") (Variable "$cell_61"))
    (ExclusiveLink (Variable "$cell_42") (Variable "$cell_63"))
    (ExclusiveLink (Variable "$cell_43") (Variable "$cell_51"))
    (ExclusiveLink (Variable "$cell_43") (Variable "$cell_55"))
    (ExclusiveLink (Variable "$cell_43") (Variable "$cell_62"))
    (ExclusiveLink (Variable "$cell_43") (Variable "$cell_64"))
    (ExclusiveLink (Variable "$cell_44") (Variable "$cell_52"))
    (ExclusiveLink (Variable "$cell_44") (Variable "$cell_56"))
    (ExclusiveLink (Variable "$cell_44") (Variable "$cell_63"))
    (ExclusiveLink (Variable "$cell_44") (Variable "$cell_65"))
    (ExclusiveLink (Variable "$cell_45") (Variable "$cell_53"))
    (ExclusiveLink (Variable "$cell_45") (Variable "$cell_57"))
    (ExclusiveLink (Variable "$cell_45") (Variable "$cell_64"))
    (ExclusiveLink (Variable "$cell_45") (Variable "$cell_66"))
    (ExclusiveLink (Variable "$cell_46") (Variable "$cell_54"))
    (ExclusiveLink (Variable "$cell_46") (Variable "$cell_58"))
    (ExclusiveLink (Variable "$cell_46") (Variable "$cell_65"))
    (ExclusiveLink (Variable "$cell_46") (Variable "$cell_67"))
    (ExclusiveLink (Variable "$cell_47") (Variable "$cell_55"))
    (ExclusiveLink (Variable "$cell_47") (Variable "$cell_59"))
    (ExclusiveLink (Variable "$cell_47") (Variable "$cell_66"))
    (ExclusiveLink (Variable "$cell_47") (Variable "$cell_68"))
    (ExclusiveLink (Variable "$cell_48") (Variable "$cell_56"))
    (ExclusiveLink (Variable "$cell_48") (Variable "$cell_67"))
    (ExclusiveLink (Variable "$cell_48") (Variable "$cell_69"))
    (ExclusiveLink (Variable "$cell_49") (Variable "$cell_57"))
    (ExclusiveLink (Variable "$cell_49") (Variable "$cell_68"))

    ; From row 5
    (ExclusiveLink (Variable "$cell_51") (Variable "$cell_63"))
    (ExclusiveLink (Variable "$cell_51") (Variable "$cell_72"))
    (ExclusiveLink (Variable "$cell_52") (Variable "$cell_64"))
    (ExclusiveLink (Variable "$cell_52") (Variable "$cell_71"))
    (ExclusiveLink (Variable "$cell_52") (Variable "$cell_73"))
    (ExclusiveLink (Variable "$cell_53") (Variable "$cell_61"))
    (ExclusiveLink (Variable "$cell_53") (Variable "$cell_65"))
    (ExclusiveLink (Variable "$cell_53") (Variable "$cell_72"))
    (ExclusiveLink (Variable "$cell_53") (Variable "$cell_74"))
    (ExclusiveLink (Variable "$cell_54") (Variable "$cell_62"))
    (ExclusiveLink (Variable "$cell_54") (Variable "$cell_66"))
    (ExclusiveLink (Variable "$cell_54") (Variable "$cell_73"))
    (ExclusiveLink (Variable "$cell_54") (Variable "$cell_75"))
    (ExclusiveLink (Variable "$cell_55") (Variable "$cell_63"))
    (ExclusiveLink (Variable "$cell_55") (Variable "$cell_67"))
    (ExclusiveLink (Variable "$cell_55") (Variable "$cell_74"))
    (ExclusiveLink (Variable "$cell_55") (Variable "$cell_76"))
    (ExclusiveLink (Variable "$cell_56") (Variable "$cell_64"))
    (ExclusiveLink (Variable "$cell_56") (Variable "$cell_68"))
    (ExclusiveLink (Variable "$cell_56") (Variable "$cell_75"))
    (ExclusiveLink (Variable "$cell_56") (Variable "$cell_77"))
    (ExclusiveLink (Variable "$cell_57") (Variable "$cell_65"))
    (ExclusiveLink (Variable "$cell_57") (Variable "$cell_69"))
    (ExclusiveLink (Variable "$cell_57") (Variable "$cell_76"))
    (ExclusiveLink (Variable "$cell_57") (Variable "$cell_78"))
    (ExclusiveLink (Variable "$cell_58") (Variable "$cell_66"))
    (ExclusiveLink (Variable "$cell_58") (Variable "$cell_77"))
    (ExclusiveLink (Variable "$cell_58") (Variable "$cell_79"))
    (ExclusiveLink (Variable "$cell_59") (Variable "$cell_67"))
    (ExclusiveLink (Variable "$cell_59") (Variable "$cell_78"))

    ; From row 6
    (ExclusiveLink (Variable "$cell_61") (Variable "$cell_73"))
    (ExclusiveLink (Variable "$cell_61") (Variable "$cell_82"))
    (ExclusiveLink (Variable "$cell_62") (Variable "$cell_74"))
    (ExclusiveLink (Variable "$cell_62") (Variable "$cell_81"))
    (ExclusiveLink (Variable "$cell_62") (Variable "$cell_83"))
    (ExclusiveLink (Variable "$cell_63") (Variable "$cell_71"))
    (ExclusiveLink (Variable "$cell_63") (Variable "$cell_75"))
    (ExclusiveLink (Variable "$cell_63") (Variable "$cell_82"))
    (ExclusiveLink (Variable "$cell_63") (Variable "$cell_84"))
    (ExclusiveLink (Variable "$cell_64") (Variable "$cell_72"))
    (ExclusiveLink (Variable "$cell_64") (Variable "$cell_76"))
    (ExclusiveLink (Variable "$cell_64") (Variable "$cell_83"))
    (ExclusiveLink (Variable "$cell_64") (Variable "$cell_85"))
    (ExclusiveLink (Variable "$cell_65") (Variable "$cell_73"))
    (ExclusiveLink (Variable "$cell_65") (Variable "$cell_77"))
    (ExclusiveLink (Variable "$cell_65") (Variable "$cell_84"))
    (ExclusiveLink (Variable "$cell_65") (Variable "$cell_86"))
    (ExclusiveLink (Variable "$cell_66") (Variable "$cell_74"))
    (ExclusiveLink (Variable "$cell_66") (Variable "$cell_78"))
    (ExclusiveLink (Variable "$cell_66") (Variable "$cell_85"))
    (ExclusiveLink (Variable "$cell_66") (Variable "$cell_87"))
    (ExclusiveLink (Variable "$cell_67") (Variable "$cell_75"))
    (ExclusiveLink (Variable "$cell_67") (Variable "$cell_79"))
    (ExclusiveLink (Variable "$cell_67") (Variable "$cell_86"))
    (ExclusiveLink (Variable "$cell_67") (Variable "$cell_88"))
    (ExclusiveLink (Variable "$cell_68") (Variable "$cell_76"))
    (ExclusiveLink (Variable "$cell_68") (Variable "$cell_87"))
    (ExclusiveLink (Variable "$cell_68") (Variable "$cell_89"))
    (ExclusiveLink (Variable "$cell_69") (Variable "$cell_77"))
    (ExclusiveLink (Variable "$cell_69") (Variable "$cell_88"))

    ; From row 7
    (ExclusiveLink (Variable "$cell_71") (Variable "$cell_83"))
    (ExclusiveLink (Variable "$cell_71") (Variable "$cell_92"))
    (ExclusiveLink (Variable "$cell_72") (Variable "$cell_84"))
    (ExclusiveLink (Variable "$cell_72") (Variable "$cell_91"))
    (ExclusiveLink (Variable "$cell_72") (Variable "$cell_93"))
    (ExclusiveLink (Variable "$cell_73") (Variable "$cell_81"))
    (ExclusiveLink (Variable "$cell_73") (Variable "$cell_85"))
    (ExclusiveLink (Variable "$cell_73") (Variable "$cell_92"))
    (ExclusiveLink (Variable "$cell_73") (Variable "$cell_94"))
    (ExclusiveLink (Variable "$cell_74") (Variable "$cell_82"))
    (ExclusiveLink (Variable "$cell_74") (Variable "$cell_86"))
    (ExclusiveLink (Variable "$cell_74") (Variable "$cell_93"))
    (ExclusiveLink (Variable "$cell_74") (Variable "$cell_95"))
    (ExclusiveLink (Variable "$cell_75") (Variable "$cell_83"))
    (ExclusiveLink (Variable "$cell_75") (Variable "$cell_87"))
    (ExclusiveLink (Variable "$cell_75") (Variable "$cell_94"))
    (ExclusiveLink (Variable "$cell_75") (Variable "$cell_96"))
    (ExclusiveLink (Variable "$cell_76") (Variable "$cell_84"))
    (ExclusiveLink (Variable "$cell_76") (Variable "$cell_88"))
    (ExclusiveLink (Variable "$cell_76") (Variable "$cell_95"))
    (ExclusiveLink (Variable "$cell_76") (Variable "$cell_97"))
    (ExclusiveLink (Variable "$cell_77") (Variable "$cell_85"))
    (ExclusiveLink (Variable "$cell_77") (Variable "$cell_89"))
    (ExclusiveLink (Variable "$cell_77") (Variable "$cell_96"))
    (ExclusiveLink (Variable "$cell_77") (Variable "$cell_98"))
    (ExclusiveLink (Variable "$cell_78") (Variable "$cell_86"))
    (ExclusiveLink (Variable "$cell_78") (Variable "$cell_97"))
    (ExclusiveLink (Variable "$cell_78") (Variable "$cell_99"))
    (ExclusiveLink (Variable "$cell_79") (Variable "$cell_87"))
    (ExclusiveLink (Variable "$cell_79") (Variable "$cell_98"))

    ; From row 8
    (ExclusiveLink (Variable "$cell_81") (Variable "$cell_93"))
    (ExclusiveLink (Variable "$cell_82") (Variable "$cell_94"))
    (ExclusiveLink (Variable "$cell_83") (Variable "$cell_91"))
    (ExclusiveLink (Variable "$cell_83") (Variable "$cell_95"))
    (ExclusiveLink (Variable "$cell_84") (Variable "$cell_92"))
    (ExclusiveLink (Variable "$cell_84") (Variable "$cell_96"))
    (ExclusiveLink (Variable "$cell_85") (Variable "$cell_93"))
    (ExclusiveLink (Variable "$cell_85") (Variable "$cell_97"))
    (ExclusiveLink (Variable "$cell_86") (Variable "$cell_94"))
    (ExclusiveLink (Variable "$cell_86") (Variable "$cell_98"))
    (ExclusiveLink (Variable "$cell_87") (Variable "$cell_95"))
    (ExclusiveLink (Variable "$cell_87") (Variable "$cell_99"))
    (ExclusiveLink (Variable "$cell_88") (Variable "$cell_96"))
    (ExclusiveLink (Variable "$cell_89") (Variable "$cell_97"))

    ; From row 9 - only upward knight moves remain (downward are off-grid)
    (ExclusiveLink (Variable "$cell_93") (Variable "$cell_81"))
    (ExclusiveLink (Variable "$cell_94") (Variable "$cell_82"))
    (ExclusiveLink (Variable "$cell_95") (Variable "$cell_83"))
    (ExclusiveLink (Variable "$cell_96") (Variable "$cell_84"))
    (ExclusiveLink (Variable "$cell_97") (Variable "$cell_85"))
    (ExclusiveLink (Variable "$cell_98") (Variable "$cell_86"))
    (ExclusiveLink (Variable "$cell_99") (Variable "$cell_87"))
  ))

; ============================================================
; Anti-king constraints (diagonal adjacency only)
; Orthogonal adjacency is already covered by row/column constraints.
; ============================================================

(define (anti-king-constraints)
  (list
    ; Row 1-2 diagonals
    (ExclusiveLink (Variable "$cell_11") (Variable "$cell_22"))
    (ExclusiveLink (Variable "$cell_12") (Variable "$cell_21"))
    (ExclusiveLink (Variable "$cell_12") (Variable "$cell_23"))
    (ExclusiveLink (Variable "$cell_13") (Variable "$cell_22"))
    (ExclusiveLink (Variable "$cell_13") (Variable "$cell_24"))
    (ExclusiveLink (Variable "$cell_14") (Variable "$cell_23"))
    (ExclusiveLink (Variable "$cell_14") (Variable "$cell_25"))
    (ExclusiveLink (Variable "$cell_15") (Variable "$cell_24"))
    (ExclusiveLink (Variable "$cell_15") (Variable "$cell_26"))
    (ExclusiveLink (Variable "$cell_16") (Variable "$cell_25"))
    (ExclusiveLink (Variable "$cell_16") (Variable "$cell_27"))
    (ExclusiveLink (Variable "$cell_17") (Variable "$cell_26"))
    (ExclusiveLink (Variable "$cell_17") (Variable "$cell_28"))
    (ExclusiveLink (Variable "$cell_18") (Variable "$cell_27"))
    (ExclusiveLink (Variable "$cell_18") (Variable "$cell_29"))
    (ExclusiveLink (Variable "$cell_19") (Variable "$cell_28"))

    ; Row 2-3 diagonals
    (ExclusiveLink (Variable "$cell_21") (Variable "$cell_32"))
    (ExclusiveLink (Variable "$cell_22") (Variable "$cell_31"))
    (ExclusiveLink (Variable "$cell_22") (Variable "$cell_33"))
    (ExclusiveLink (Variable "$cell_23") (Variable "$cell_32"))
    (ExclusiveLink (Variable "$cell_23") (Variable "$cell_34"))
    (ExclusiveLink (Variable "$cell_24") (Variable "$cell_33"))
    (ExclusiveLink (Variable "$cell_24") (Variable "$cell_35"))
    (ExclusiveLink (Variable "$cell_25") (Variable "$cell_34"))
    (ExclusiveLink (Variable "$cell_25") (Variable "$cell_36"))
    (ExclusiveLink (Variable "$cell_26") (Variable "$cell_35"))
    (ExclusiveLink (Variable "$cell_26") (Variable "$cell_37"))
    (ExclusiveLink (Variable "$cell_27") (Variable "$cell_36"))
    (ExclusiveLink (Variable "$cell_27") (Variable "$cell_38"))
    (ExclusiveLink (Variable "$cell_28") (Variable "$cell_37"))
    (ExclusiveLink (Variable "$cell_28") (Variable "$cell_39"))
    (ExclusiveLink (Variable "$cell_29") (Variable "$cell_38"))

    ; Row 3-4 diagonals
    (ExclusiveLink (Variable "$cell_31") (Variable "$cell_42"))
    (ExclusiveLink (Variable "$cell_32") (Variable "$cell_41"))
    (ExclusiveLink (Variable "$cell_32") (Variable "$cell_43"))
    (ExclusiveLink (Variable "$cell_33") (Variable "$cell_42"))
    (ExclusiveLink (Variable "$cell_33") (Variable "$cell_44"))
    (ExclusiveLink (Variable "$cell_34") (Variable "$cell_43"))
    (ExclusiveLink (Variable "$cell_34") (Variable "$cell_45"))
    (ExclusiveLink (Variable "$cell_35") (Variable "$cell_44"))
    (ExclusiveLink (Variable "$cell_35") (Variable "$cell_46"))
    (ExclusiveLink (Variable "$cell_36") (Variable "$cell_45"))
    (ExclusiveLink (Variable "$cell_36") (Variable "$cell_47"))
    (ExclusiveLink (Variable "$cell_37") (Variable "$cell_46"))
    (ExclusiveLink (Variable "$cell_37") (Variable "$cell_48"))
    (ExclusiveLink (Variable "$cell_38") (Variable "$cell_47"))
    (ExclusiveLink (Variable "$cell_38") (Variable "$cell_49"))
    (ExclusiveLink (Variable "$cell_39") (Variable "$cell_48"))

    ; Row 4-5 diagonals
    (ExclusiveLink (Variable "$cell_41") (Variable "$cell_52"))
    (ExclusiveLink (Variable "$cell_42") (Variable "$cell_51"))
    (ExclusiveLink (Variable "$cell_42") (Variable "$cell_53"))
    (ExclusiveLink (Variable "$cell_43") (Variable "$cell_52"))
    (ExclusiveLink (Variable "$cell_43") (Variable "$cell_54"))
    (ExclusiveLink (Variable "$cell_44") (Variable "$cell_53"))
    (ExclusiveLink (Variable "$cell_44") (Variable "$cell_55"))
    (ExclusiveLink (Variable "$cell_45") (Variable "$cell_54"))
    (ExclusiveLink (Variable "$cell_45") (Variable "$cell_56"))
    (ExclusiveLink (Variable "$cell_46") (Variable "$cell_55"))
    (ExclusiveLink (Variable "$cell_46") (Variable "$cell_57"))
    (ExclusiveLink (Variable "$cell_47") (Variable "$cell_56"))
    (ExclusiveLink (Variable "$cell_47") (Variable "$cell_58"))
    (ExclusiveLink (Variable "$cell_48") (Variable "$cell_57"))
    (ExclusiveLink (Variable "$cell_48") (Variable "$cell_59"))
    (ExclusiveLink (Variable "$cell_49") (Variable "$cell_58"))

    ; Row 5-6 diagonals
    (ExclusiveLink (Variable "$cell_51") (Variable "$cell_62"))
    (ExclusiveLink (Variable "$cell_52") (Variable "$cell_61"))
    (ExclusiveLink (Variable "$cell_52") (Variable "$cell_63"))
    (ExclusiveLink (Variable "$cell_53") (Variable "$cell_62"))
    (ExclusiveLink (Variable "$cell_53") (Variable "$cell_64"))
    (ExclusiveLink (Variable "$cell_54") (Variable "$cell_63"))
    (ExclusiveLink (Variable "$cell_54") (Variable "$cell_65"))
    (ExclusiveLink (Variable "$cell_55") (Variable "$cell_64"))
    (ExclusiveLink (Variable "$cell_55") (Variable "$cell_66"))
    (ExclusiveLink (Variable "$cell_56") (Variable "$cell_65"))
    (ExclusiveLink (Variable "$cell_56") (Variable "$cell_67"))
    (ExclusiveLink (Variable "$cell_57") (Variable "$cell_66"))
    (ExclusiveLink (Variable "$cell_57") (Variable "$cell_68"))
    (ExclusiveLink (Variable "$cell_58") (Variable "$cell_67"))
    (ExclusiveLink (Variable "$cell_58") (Variable "$cell_69"))
    (ExclusiveLink (Variable "$cell_59") (Variable "$cell_68"))

    ; Row 6-7 diagonals
    (ExclusiveLink (Variable "$cell_61") (Variable "$cell_72"))
    (ExclusiveLink (Variable "$cell_62") (Variable "$cell_71"))
    (ExclusiveLink (Variable "$cell_62") (Variable "$cell_73"))
    (ExclusiveLink (Variable "$cell_63") (Variable "$cell_72"))
    (ExclusiveLink (Variable "$cell_63") (Variable "$cell_74"))
    (ExclusiveLink (Variable "$cell_64") (Variable "$cell_73"))
    (ExclusiveLink (Variable "$cell_64") (Variable "$cell_75"))
    (ExclusiveLink (Variable "$cell_65") (Variable "$cell_74"))
    (ExclusiveLink (Variable "$cell_65") (Variable "$cell_76"))
    (ExclusiveLink (Variable "$cell_66") (Variable "$cell_75"))
    (ExclusiveLink (Variable "$cell_66") (Variable "$cell_77"))
    (ExclusiveLink (Variable "$cell_67") (Variable "$cell_76"))
    (ExclusiveLink (Variable "$cell_67") (Variable "$cell_78"))
    (ExclusiveLink (Variable "$cell_68") (Variable "$cell_77"))
    (ExclusiveLink (Variable "$cell_68") (Variable "$cell_79"))
    (ExclusiveLink (Variable "$cell_69") (Variable "$cell_78"))

    ; Row 7-8 diagonals
    (ExclusiveLink (Variable "$cell_71") (Variable "$cell_82"))
    (ExclusiveLink (Variable "$cell_72") (Variable "$cell_81"))
    (ExclusiveLink (Variable "$cell_72") (Variable "$cell_83"))
    (ExclusiveLink (Variable "$cell_73") (Variable "$cell_82"))
    (ExclusiveLink (Variable "$cell_73") (Variable "$cell_84"))
    (ExclusiveLink (Variable "$cell_74") (Variable "$cell_83"))
    (ExclusiveLink (Variable "$cell_74") (Variable "$cell_85"))
    (ExclusiveLink (Variable "$cell_75") (Variable "$cell_84"))
    (ExclusiveLink (Variable "$cell_75") (Variable "$cell_86"))
    (ExclusiveLink (Variable "$cell_76") (Variable "$cell_85"))
    (ExclusiveLink (Variable "$cell_76") (Variable "$cell_87"))
    (ExclusiveLink (Variable "$cell_77") (Variable "$cell_86"))
    (ExclusiveLink (Variable "$cell_77") (Variable "$cell_88"))
    (ExclusiveLink (Variable "$cell_78") (Variable "$cell_87"))
    (ExclusiveLink (Variable "$cell_78") (Variable "$cell_89"))
    (ExclusiveLink (Variable "$cell_79") (Variable "$cell_88"))

    ; Row 8-9 diagonals
    (ExclusiveLink (Variable "$cell_81") (Variable "$cell_92"))
    (ExclusiveLink (Variable "$cell_82") (Variable "$cell_91"))
    (ExclusiveLink (Variable "$cell_82") (Variable "$cell_93"))
    (ExclusiveLink (Variable "$cell_83") (Variable "$cell_92"))
    (ExclusiveLink (Variable "$cell_83") (Variable "$cell_94"))
    (ExclusiveLink (Variable "$cell_84") (Variable "$cell_93"))
    (ExclusiveLink (Variable "$cell_84") (Variable "$cell_95"))
    (ExclusiveLink (Variable "$cell_85") (Variable "$cell_94"))
    (ExclusiveLink (Variable "$cell_85") (Variable "$cell_96"))
    (ExclusiveLink (Variable "$cell_86") (Variable "$cell_95"))
    (ExclusiveLink (Variable "$cell_86") (Variable "$cell_97"))
    (ExclusiveLink (Variable "$cell_87") (Variable "$cell_96"))
    (ExclusiveLink (Variable "$cell_87") (Variable "$cell_98"))
    (ExclusiveLink (Variable "$cell_88") (Variable "$cell_97"))
    (ExclusiveLink (Variable "$cell_88") (Variable "$cell_99"))
    (ExclusiveLink (Variable "$cell_89") (Variable "$cell_98"))
  ))

; ============================================================
; Non-consecutive constraints
; Orthogonally adjacent cells cannot have consecutive values.
; Uses GroundedPredicate with ugly string comparison.
; ============================================================

(define (non-consecutive-constraints)
  (list
    ; Row 1 horizontal pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_11") (Variable "$cell_12")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_12") (Variable "$cell_13")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_13") (Variable "$cell_14")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_14") (Variable "$cell_15")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_15") (Variable "$cell_16")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_16") (Variable "$cell_17")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_17") (Variable "$cell_18")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_18") (Variable "$cell_19")))

    ; Row 2 horizontal pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_21") (Variable "$cell_22")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_22") (Variable "$cell_23")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_23") (Variable "$cell_24")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_24") (Variable "$cell_25")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_25") (Variable "$cell_26")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_26") (Variable "$cell_27")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_27") (Variable "$cell_28")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_28") (Variable "$cell_29")))

    ; Row 3 horizontal pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_31") (Variable "$cell_32")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_32") (Variable "$cell_33")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_33") (Variable "$cell_34")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_34") (Variable "$cell_35")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_35") (Variable "$cell_36")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_36") (Variable "$cell_37")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_37") (Variable "$cell_38")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_38") (Variable "$cell_39")))

    ; Row 4 horizontal pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_41") (Variable "$cell_42")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_42") (Variable "$cell_43")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_43") (Variable "$cell_44")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_44") (Variable "$cell_45")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_45") (Variable "$cell_46")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_46") (Variable "$cell_47")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_47") (Variable "$cell_48")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_48") (Variable "$cell_49")))

    ; Row 5 horizontal pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_51") (Variable "$cell_52")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_52") (Variable "$cell_53")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_53") (Variable "$cell_54")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_54") (Variable "$cell_55")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_55") (Variable "$cell_56")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_56") (Variable "$cell_57")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_57") (Variable "$cell_58")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_58") (Variable "$cell_59")))

    ; Row 6 horizontal pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_61") (Variable "$cell_62")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_62") (Variable "$cell_63")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_63") (Variable "$cell_64")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_64") (Variable "$cell_65")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_65") (Variable "$cell_66")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_66") (Variable "$cell_67")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_67") (Variable "$cell_68")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_68") (Variable "$cell_69")))

    ; Row 7 horizontal pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_71") (Variable "$cell_72")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_72") (Variable "$cell_73")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_73") (Variable "$cell_74")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_74") (Variable "$cell_75")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_75") (Variable "$cell_76")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_76") (Variable "$cell_77")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_77") (Variable "$cell_78")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_78") (Variable "$cell_79")))

    ; Row 8 horizontal pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_81") (Variable "$cell_82")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_82") (Variable "$cell_83")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_83") (Variable "$cell_84")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_84") (Variable "$cell_85")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_85") (Variable "$cell_86")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_86") (Variable "$cell_87")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_87") (Variable "$cell_88")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_88") (Variable "$cell_89")))

    ; Row 9 horizontal pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_91") (Variable "$cell_92")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_92") (Variable "$cell_93")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_93") (Variable "$cell_94")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_94") (Variable "$cell_95")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_95") (Variable "$cell_96")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_96") (Variable "$cell_97")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_97") (Variable "$cell_98")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_98") (Variable "$cell_99")))

    ; Column 1 vertical pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_11") (Variable "$cell_21")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_21") (Variable "$cell_31")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_31") (Variable "$cell_41")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_41") (Variable "$cell_51")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_51") (Variable "$cell_61")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_61") (Variable "$cell_71")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_71") (Variable "$cell_81")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_81") (Variable "$cell_91")))

    ; Column 2 vertical pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_12") (Variable "$cell_22")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_22") (Variable "$cell_32")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_32") (Variable "$cell_42")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_42") (Variable "$cell_52")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_52") (Variable "$cell_62")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_62") (Variable "$cell_72")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_72") (Variable "$cell_82")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_82") (Variable "$cell_92")))

    ; Column 3 vertical pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_13") (Variable "$cell_23")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_23") (Variable "$cell_33")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_33") (Variable "$cell_43")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_43") (Variable "$cell_53")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_53") (Variable "$cell_63")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_63") (Variable "$cell_73")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_73") (Variable "$cell_83")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_83") (Variable "$cell_93")))

    ; Column 4 vertical pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_14") (Variable "$cell_24")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_24") (Variable "$cell_34")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_34") (Variable "$cell_44")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_44") (Variable "$cell_54")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_54") (Variable "$cell_64")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_64") (Variable "$cell_74")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_74") (Variable "$cell_84")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_84") (Variable "$cell_94")))

    ; Column 5 vertical pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_15") (Variable "$cell_25")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_25") (Variable "$cell_35")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_35") (Variable "$cell_45")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_45") (Variable "$cell_55")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_55") (Variable "$cell_65")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_65") (Variable "$cell_75")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_75") (Variable "$cell_85")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_85") (Variable "$cell_95")))

    ; Column 6 vertical pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_16") (Variable "$cell_26")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_26") (Variable "$cell_36")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_36") (Variable "$cell_46")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_46") (Variable "$cell_56")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_56") (Variable "$cell_66")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_66") (Variable "$cell_76")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_76") (Variable "$cell_86")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_86") (Variable "$cell_96")))

    ; Column 7 vertical pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_17") (Variable "$cell_27")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_27") (Variable "$cell_37")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_37") (Variable "$cell_47")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_47") (Variable "$cell_57")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_57") (Variable "$cell_67")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_67") (Variable "$cell_77")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_77") (Variable "$cell_87")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_87") (Variable "$cell_97")))

    ; Column 8 vertical pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_18") (Variable "$cell_28")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_28") (Variable "$cell_38")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_38") (Variable "$cell_48")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_48") (Variable "$cell_58")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_58") (Variable "$cell_68")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_68") (Variable "$cell_78")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_78") (Variable "$cell_88")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_88") (Variable "$cell_98")))

    ; Column 9 vertical pairs
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_19") (Variable "$cell_29")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_29") (Variable "$cell_39")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_39") (Variable "$cell_49")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_49") (Variable "$cell_59")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_59") (Variable "$cell_69")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_69") (Variable "$cell_79")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_79") (Variable "$cell_89")))
    (Evaluation (GroundedPredicate "scm:not-consecutive?")
      (List (Variable "$cell_89") (Variable "$cell_99")))
  ))

; ============================================================
; Combined miracle constraints
; ============================================================

(define (miracle-constraints)
  (append
    (anti-knight-constraints)
    (anti-king-constraints)
    (non-consecutive-constraints)))

; Full miracle sudoku constraints (standard + miracle)
(define (miracle-sudoku-constraints)
  (append
    (sudoku-constraints)
    (miracle-constraints)))