Empty room?

OK, this problem should be fairly simple, however I’m not familiar enough with Inform’s functions to come up with a solution. In my game there are five rooms: red, green, blue, yellow and orange. There are two keys: black and white.

I have two basic needs-

  1. At the start of the game I want both keys to be hidden at random within one of the rooms, but with only one key per room. Now, If I say - “when play begins: move white key to random room”, and do the same for the other key, how can I make sure they don’t end up in the same room?

  2. Also, during the game, a goblin can steal one of the keys from you and hide it in one of the rooms, but again with only one key per room. How do I have the goblin check if the room is empty to see if he is allowed to hide it there?

Thankful for any help you can give.

LAMPGETTER
:open_mouth:

Definition: a room is keyless if it does not enclose a key.

Then you can move each key to “a random keyless room”.

Note that you’ll want to do this within a “repeat running through” construction, otherwise all keys will be moved to the same (initially keyless) room!

[code]When play begins:
repeat with K running through keys:
now K is in a random keyless room.

Definition: a room is keyless if it does not enclose a key.[/code]