MantisBT - Core Inform
View Issue Details
0000584Core InformPhrases and functional programmingpublic2011-02-25 07:072014-05-07 07:34
otistdog 
graham 
normalseriousalways
closedfixed 
x86Windows7
6G60 
6L02 
(serious/mild) Game compiles but misbehaves
0000584: Number of turns since an action can be both zero and more than zero simultaneously
I was trying to get more understanding of a different issue I reported, so I put together the following code to test some assumptions. The test shows that the evaluation of the number of turns since an action has occurred obeys very strange rules that may not be functioning as intended.

Note that the first every turn rule always prints a sentence BEFORE the pebble has been examined. This behavior seems to occur for any positive number of turns other than 1 (e.g. "less than 3 turns"). If the test is changed to "less than 0 turns", the sentence is not printed.

Also note that in the second every turn rule, no conditions evaluate as true before the pebble is examined, but AFTER the pebble is examined, BOTH the zero turns test and one of the more-than-zero turns tests will evaluate to true, producing output like "The pebble has been examined for zeroone turns."
"Test Story" by "Otis T. Dog"

Noplace is a room.

A pebble is here.

[always evaluates true when pebble has not been examined]
Every turn:
if we have examined the pebble for less than 1 turn, say "The pebble has been examined for less than one turn. "

Every turn:
say "The pebble has been examined for ";
if we have examined the pebble for 0 turns, say "zero"; [always evaluates true after pebble has been examined]
if we have examined the pebble for 1 turn, say "one";
if we have examined the pebble for 2 turns, say "two";
if we have examined the pebble for 3 turns, say "three";
if we have examined the pebble for more than 3 turns, say "many";
say " turns."

Test me with "z / x pebble / z / z / z / z".
I could not figure out a way to directly show what Inform thought the number of turns since an event was, which is why I had to go about it indirectly. I would have liked to be able to evaluate "[the number of turns we have examined the pebble]" or something similar.
No tags attached.
Issue History
2011-02-25 07:07otistdogNew Issue
2011-02-27 19:39EmacsUserNote Added: 0001057
2011-02-27 19:39EmacsUserStatusnew => confirmed
2014-01-19 14:35grahamNote Added: 0002335
2014-01-19 14:35grahamStatusconfirmed => resolved
2014-01-19 14:35grahamResolutionopen => fixed
2014-01-19 14:35grahamAssigned To => graham
2014-05-07 07:34jmcgrewFixed in Version => 6L02
2014-05-07 07:34jmcgrewStatusresolved => closed

Notes
(0001057)
EmacsUser   
2011-02-27 19:39   
The first every turn rule is behaving as expected (see my late reply 0000559:0001055). On the other hand, the I7 line

- - - -
if we have examined the pebble for 0 turns, say "zero";
- - - -

compiles to

- - - -
 if (TestSinglePastState(0, 1, false, 2)) { say__p=1;ParaContent(); print (PrintText) SC_13; .L_Say4; .L_SayX4; }
- - - -

when it ought to be

- - - -
 if (TestSinglePastState(0, 1, false, 2) == 0) { say__p=1;ParaContent(); print (PrintText) SC_13; .L_Say4; .L_SayX4; }
- - - -

So, confirmed.
(0002335)
graham   
2014-01-19 14:35   
The 0 turns case is fixed, that being the bug here.