Dinesman's multiple-dwelling problem: Difference between revisions

Added Bracmat
(Promoted to task as the state of the talk page discussions and the number of solutions seems to allow this now.)
(Added Bracmat)
Line 8:
;The problem:
:''Baker, Cooper, Fletcher, Miller, and Smith live on different floors of an apartment house that contains only five floors. Baker does not live on the top floor. Cooper does not live on the bottom floor. Fletcher does not live on either the top or the bottom floor. Miller lives on a higher floor than does Cooper. Smith does not live on a floor adjacent to Fletcher's. Fletcher does not live on a floor adjacent to Cooper's. Where does everyone live?''
 
=={{header|Bracmat}}==
<lang Bracmat>( Baker Cooper Fletcher Miller Smith:?people
& ( constraints
=
. !arg
: ~(? Baker)
: ~(Cooper ?)
: ~(Fletcher ?|? Fletcher)
: ? Cooper ? Miller ?
: (? Smith Fletcher ?|? Fletcher Smith ?)
: (? Cooper Fletcher ?|? Fletcher Cooper ?)
)
& ( solution
= floors persons A Z person
. !arg:(?floors.?persons)
& ( !persons:
& constraints$!floors
| !persons
: ?A
%?`person
(?Z&solution$(!floors !person.!A !Z))
)
)
& solution$(.!people)
)
</lang>
<lang>Baker Cooper Fletcher Miller Smith</lang>
 
=={{header|C}}==
483

edits