Pages

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.
 description
 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 think it's the best IF language I've ever seen - and I *am* a programmer."

Andrew Heale