My goal is to have a value for how complete a room is, so I can
have a mechanism to say “okay, if there are no loops that way, and all the rooms are done, and an option is set to block the player from going places they dont need, block them”
1a) have something similar for last lousy points as well
given a branch between two rooms that lead to separate areas, have a mechanism that directs the player to the part with more unsolved parts, if possible
The responses below went a good ways towards what I want, but it missed some cases. (I could of course use magic numbers to describe how complete a room is, but I’d rather use better programming practice if I can!)
They show how enumerations could be used e.g.
unstarted is always 0. done is always 100. started is always 25. nearly-done is always 75.
a room has a number called percent-done. percent-done is usually unstarted.
But I was trying to define a different value and act on that. Both my attempts below failed.
completions are a kind of value. the completions are unstarted, started, nearly-done and done.
a room has a completion called how-complete. how-complete of a room is usually unstarted.
a completion has a number called percent-done. percent-done of done is 100. percent-done of started is 25. percent-done of nearly-done is 75. percent-done of unstarted is 0. [first try, failed]
to decide which number is percent-done-1 of (c - a completion): [second try, failed]
if c is done, 100;
if c is nearly-done, 75;
if c is started, 25;
if c is unstarted, 0;
50;
For this one, you need to explicitly write decide on 100, unless you’re writing a “to decide whether” phrase (in which case the short forms “yes” and “no” are recognized).
A completion is a kind of value. The completions are unstarted, started, nearly-done and done.
A completion has a number called percent-done.
The percent-done of done is 100.
The percent-done of nearly-done is 75.
The percent-done of started is 25.
The percent-done of unstarted is 0.
When play begins:
repeat with C running through completions:
say "[C]: [percent-done of C].";
I’m not sure why aschultz’s original try didn’t work.
I was hoping it was something simple, but sometimes, when it’s something too simple, you feel silly just how simple it was!
Thanks for noting this–and I appreciate the discussion of other things to try. I have a tendency to say “oh, what I have is good enough” too often and this sort of not-quite-gratitude holds me back from sensible expansions that make ideas that work, work even better.