the-infocom-files / amfv

A Mind Forever Voyaging
5 stars 2 forks source link

"WAIT UNTIL DUSK" almost never works correctly #92

Open eriktorbjorn opened 4 years ago

eriktorbjorn commented 4 years ago

The details for when the sun rises and sets can be found in I-SUNRISE-SUNSET, but the short version is that in January dusk begins at 5:28pm. Each month after that it starts 20 minutes later, i.e. 5:48pm in February, 6:08pm in March, etc.

For instance, here's June 5th 2051. It should happen at or just after 6:48pm:

>DATE
Today is 6/5/2051.

>WAIT UNTIL 6:47
Time passes...

>TIME
It is 6:47pm.

>WAIT 1 MINUTE
Time passes...

>WAIT 1 MINUTE
Time passes...

>WAIT 1 MINUTE
Time passes...

Twilight casts its long shadows across the city as the sun disappears in the
west.

>TIME
It is 6:50pm.

Eh. Close enough.

But here's how V-WAIT-UNTIL calculates the time for "WAIT UNTIL DUSK":

           (<PRSO? ,DUSK>
        <COND (,SIMULATING ;"5:08pm in January, 6:48pm in June"
               <SETG P-NUMBER <- 1028 <- <* ,SMONTH 20> 20>>>)
              (T
               <SETG P-NUMBER 1075>)>
        <SET NAMED-TIME T>)>

So in January it's 5:08pm, but then it starts 20 minutes earlier for each subsequent month. Let's try it for the same date:

>DATE
Today is 6/5/2051.

>WAIT UNTIL DUSK
Time passes...

>TIME
It is 3:28pm.

It should presumably be <+ 1028 <- <* ,SMONTH 20> 20>> instead.

arcanetrivia commented 3 years ago

I'm being very pedantic here, but the sunset times (at least - I haven't paid attention to the sunrise times) are unrealistic for the approximate latitude of Rockvil at the stated times of year - they're too late in January and February and too early in April, May, and June (even if we suppose that there is no Daylight Saving Time in the future, although doing so makes April closer). March is the closest, although still a little bit early.

ishepherd commented 3 years ago

I am so happy when I see Infocom bug notifications like this. Warms my heart in this Australian winter. 😄

eriktorbjorn commented 3 years ago

Unlike "WAIT FOR DUSK", sunrise/sunset times probably work as designed though. As noted above, there are comments in the code that indicate that dawn is at "7:35am in January, 5:55am in June" and that dusk is at "5:08pm in January, 6:48pm in June". Anything between is just interpolated.

So I would be reluctant to change anything else around that.

arcanetrivia commented 3 years ago

Probably it shouldn't be changed, no, I just found it interesting to note that the times they picked aren't really correct for the locale.