On the other hand, I was tempted to add the darkness code to the predefined Location class, but reconsidered for two reasons. First, few or no rooms in any game will ever need to be darkened, so the respective checks will be a useless overhead most of the time. Second, having a distinct DarkRoom class means you can bypass it entirely and roll your own mechanism if you want. Especially as I went with a primitive implementation which doesn't consider portable light sources. (Nor is such a thing defined in the library.)


every darkroom isa location
 is dark.
 check this is not dark
     else "It's too dark to see much."
   verb examine
     check this is not dark
       else "It's too dark to get a good look."
   end verb.
end every.

What They Say

"Man, I just finished programming a little game with Alan, and let me tell you ALAN RULES!! It's so simple, *I* can program with it."

Rob Anderson