All pastes #336895 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-02-02 10:39 UTC
rendered paste body
;; solve-puzzle
; play with amb, with enigms of Smullyan
; on the door 1 is writen : the is a draon in beind me, or a princess behind the other
; on the door 2 is writen : there is a pricess behind the other door
; Sur la porte 2 est inscrit : il y a une princesse dans l'autre cellule.
; Soit les affiches disent toutes les deux la vérité, soit elles mentent toutes les deux.
; Que contient la première cellule ? Et la seconde ?
(define (solve-puzzle)
  (let* ((door1 (amb 'princess 'dragon)) ; behind the first door there is a princess or a dragon
         (door2 (amb 'princess 'dragon))
         (door1-true (or (eqv? door1 'dragon)
                         (eqv? door2 'princess)))
         (door2-true (eqv? door1 'princess)))
    (assert (or (and door1-true door2-true)
                (and (not door1-true) (not door2-true))))
    (list door1 door2)))