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

"I-F languages are like vehicles ... using Alan is like driving a zippy, easy-handling little electric town car -- it's often all you need to take you where you want to go."

Lelah Conrad