the-infocom-files / starcross

Starcross
5 stars 3 forks source link

Inconsistent messages from the navigational computer #9

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago

The navigational computer handles both "SET COURSE FOR known mass" and "SET parameter TO value". But it responds a bit different when it won't (or can't) comply. This is all handled in COMPUTER-FCN.

Here is the code for "SET COURSE FOR known mass":

               <COND (,DOCKED?
                  <TELL ,ROPES-OFF CR>
                  <RTRUE>)
                 (,ORBIT-MATCHED
                  <TELL
"\"We just got here! I think we should look around first!\"" CR>
                  <RTRUE>)
                 (,COUNTDOWN
                  <TELL ,BURN-COMING CR>
                  <RTRUE>)
                 (,COURSE-SELECTED
                  <TELL ,IN-TRANSIT CR>
                  <RTRUE>)>

And here is the one for "SET parameter TO value":

               <COND (<G? ,VIEW-COUNT 0>
                  <TELL
"\"We just got here. You wouldn't be scared, would you?\"" CR>)
                 (<G? ,TRIP-COUNT 0>
                  <TELL ,IN-TRANSIT CR>)
                 (,DOCKED?
                  <TELL ,ROPES-OFF CR>)
                 (,COUNTDOWN
                  <TELL ,BURN-COMING CR>)
                 (T <>)>)

That they use slightly different messages is just fine, I think, but I do think they should use the same conditions. Right now, we have the following variables to look at:

Checking ORBIT-MATCHED and VIEW-COUNT is the same thing. I would prefer ORBIT-MATCHED though, since it's more obvious what it means.

Checking COURSE-SELECTED and TRIP-COUNT is not the same thing, because TRIP-COUNT is still 0 the first turn after COURSE-SELECTED is set, and apparently a few turns after that as well. You get the wrong reply if you try to change one of the parameters during that time.

And of course, the order you check things in matter as well. Right now, "SET parameter TO value" will never trigger the DOCKED? case. I think the order should to check in should be:

  1. DOCKED?
  2. ORBIT-MATCHED
  3. COURSE-SELECTED
  4. COUNTDOWN

I think that should work.

eriktorbjorn commented 5 years ago

It also checks VIEW-COUNT in a couple of other cases, while there's only one case where it checks ORBIT-MATCHED, and that's described above. Maybe we should change as little as possible here, i.e. only the COURSE-SELECTED vs TRIP-COUNT one, and the order in which things are checked?