Re: Inform trivia quiz


12 Jul 1995 22:48:54 GMT

On 12 Jul 1995 18:08:18 GMT, Gareth Rees (gdr11@cl.cam.ac.uk) said:
> Here's a little trivia quiz for expert Inform programmers.

Well, I'm relatively inexperienced, but I'll give it a shot.

> I confess it has the somewhat didactic aim of attempting to demonstrate
> that Inform may not necessarily be the right language to advocate for
> every non-programmer.

Well, at least you're honest. But most of these seem to be gripes about
super-technical stuff, which should either be fixed by Graham or hacked
in the libraries. Why not provide "fixed" versions of the libraries?
With ifdefs and so forth, but in the model of (say) WorldClass.t? That
would be to obvious, I suppose. *sigh*

> 1. You have an object that appears in several places (using the
> `found_in' property), but which is `absent' to start with. Your
> code executes `give object ~absent', but the object fails to
> appear. Why not?

Hm. I suspect that's because the code which would make it appear
doesn't execute, as it is already there. (Or rather, it thinks so.)
Perhaps a solution would be to "move" it to the room?

> 2. Can you write a room so that going north wins the game, without
> producing a spurious room description before the "you have won"
> message? (Remember that going north might occur because of a
> command like "push car north").

There is a way to write a procedure that executes before every action,
although I forget how. But the sneaky way to do this is to make the
room description something like "* * * YOU HAVE WON * * *" and then
suppress the regular you-have-won message...

> 3. Can you write a vehicle in which movement produces a failure
> message of your own choosing, with no spurious text after it (for
> example, a one-way car in which "go north" produces "The car will
> only go south.").

If not by using the aforementioned pre-action procedure, I suspect
hacking the libraries would do the trick.

> 4. Can you redefine the `ask ... about ...' verb so that it parses the
> question you are asking as an object in a particular scope? Make
> sure that the player can't discover which words refer to subjects
> in the game (that is, "ask person about green aardvark" should
> produce "No reply" or something similar, regardless of whether or
> not `green aardvark' is a genuine subject of conversation).

This is a good idea, and should be easy to hack the library to fix. Am
I missing something?

> 5. How can you arrange that the command "person, yes" has the same
> effect as "say yes to person" (recall that "yes" is a verb)?

Define "yes" as an automagical "special" word, right?

> 6. What pitfalls are there in having an object called "Door to the
> kitchen"? How would you get round them (apart from renaming it
> "Kitchen door")?

Does it matter?

> 7. What bugs are there in the 5/10 beta version of "AllowPushDir" (in
> VerbLib.h)? How would you fix them?

I have no idea. Why aren't you saying this to Graham, so he can fix
them? That's the point of beta versions, after all--you needn't get
into a stink about it.

> 8. Two rooms have a glass window separating them. How would you
> implement this?

Neat idea. What I'd probably do is define an attribute "east_half", and
implement the two rooms as one room. The stuff in the east side gets
the attribute, as do I when I'm over there. I would then catch "look"
in a before-procedure, and list the stuff on my side of the room first,
then say "through the window, you can see..." and list the other half.
I'd also catch movement actions, if they have different results in the
two halves of the room. No doubt this is the "wrong way" to do this,
but it would work. (for more than two window-connected rooms, this would
still work, except with a property.)

> 9. An NPC in the game is `transparent' because he has possessions that
> the player needs to refer to, but when you give him the gun, he
> hides it in an inside pocket. Any ideas how to solve this one?
> Does your solution produce the correct response when the player
> types `objects'?

Stick it in limbo until the NPC brings it back out. (i.e. move it to
the null location)

> 10. A thief steals everything the player is carrying, but not anything
> that player is wearing. How would you code this up? What if one
> of the objects is a toffee apple that sticks to the player's hands?

Isn't there a "worn" attribute? Thus, isn't it obvious (likewise for
sticky--you could *easily* code it if it isn't already there).

> Gareth Rees

Don Blaheta
blahedo@quincy.edu
mblaheta@xnet.com