the-infocom-files / zork2

Zork II: The Wizard of Frobozz
8 stars 4 forks source link

You can close the lid, even if it already is closed #23

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago
>OPEN LID
The lid is now open.

>OPEN LID
Too late for that.

>CLOSE LID
The lid covers the keyhole.

>CLOSE LID
The lid covers the keyhole.

So PLID-FCN does check if the lid is already open if you try to open it, but has no similar check for when you try to close it:

    <COND (<VERB? OPEN RAISE MOVE>
       <COND (<FSET? ,PRSO ,OPENBIT>
          <TELL <RANDOM-ELEMENT ,DUMMY> CR>)
         (T <TELL "The lid is now open." CR>)>
       <FSET ,PRSO ,OPENBIT>)
      (<VERB? CLOSE LOWER>
       <COND (<FIRST? <COND (<EQUAL? ,HERE ,DREARY-ROOM>
                 ,KEYHOLE-2)
                (T ,KEYHOLE-1)>>
          <TELL "The keyhole is occupied." CR>)
         (T
          <TELL "The lid covers the keyhole." CR>
          <FCLEAR ,PRSO ,OPENBIT>)>)
eriktorbjorn commented 5 years ago

Note though that the use of RANDOM-ELEMENT is incorrect. It should use PICK-ONE. See https://github.com/the-infocom-files/zork2/issues/24