ANSWER TO EXERCISE 85 | |
Object steriliser "sterilising machine" with name "washing" "sterilising" "machine", add_to_scope top_of_wm go_button, before [; PushDir: AllowPushDir(); rtrue; Receive: if (receive_action==##PutOn) <<PutOn noun top_of_wm>>; SwitchOn: <<Push go_button>>; ], after [; PushDir: "It's hard work, but the steriliser does roll."; ], initial [; print "There is a sterilising machine on casters here (a kind of chemist's washing machine) with a ~go~ button. "; if (children(top_of_wm)~=0) { print "On top"; WriteListFrom(child(top_of_wm), ISARE_BIT + ENGLISH_BIT); print ". "; } if (children(self)~=0) { print "Inside"; WriteListFrom(child(self), ISARE_BIT + ENGLISH_BIT); print ". "; } ], has static container open openable; Object top_of_wm "top of the sterilising machine", with article "the", has static supporter; Object go_button "~go~ button" with name "go" "button", before [; Push, SwitchOn: "The power is off."; ], has static; |