Intelligent Hinting
version 5 by Aaron Reed
Book - Tools For Deciding Which Not Sequential Puzzle Is Next
To scour recent input for puzzle suggestions:
repeat through the Table of Temp Task Rankings:
blank out the whole row;
if puzzle-testing all, say "(Last 10 interacted-with items: [list of in-focus items])";
if puzzle-testing all, say "(Last 10 visited locations: [list of stored venues])";
[Iterate through each unique puzzle/object correspondence.]
repeat through table of Puzzle Reference:
if job entry is solved, next; [not interested in tasks that already solved.]
if item entry is a room:
[If we've recently been in this location, score points for the associated task.]
let ctr be 0;
repeat with loc running through list of stored venues:
increase ctr by 1;
if item entry is loc, score ctr puzzle points for job entry;
otherwise:
[If the object here matches a recently interacted-with object, score points based on how long ago the interaction occurred. ]
let ctr be 0;
repeat with obj running through list of in-focus items:
increase ctr by 1;
if item entry is obj, score ctr puzzle points for job entry;
[Finally, if any nouns in this puzzle's task are visible or held, score more points for that task.]
if item entry is a thing and item entry is not nothing and ( item entry is visible or item entry is held ) :
if job entry is unsolved, score 11 puzzle points for job entry. [slowdown?]
To decide what object is the best choice of the ranked puzzles under (problem - a puzzle):
sort Table of Temp Task Rankings in reverse puzz-rank order; [most likely first]
let candidate be nothing;
while candidate is nothing and there is a job in row 1 of Table of Temp Task Rankings:
choose row 1 in Table of Temp Task Rankings;
[reject any options that aren't parts of the puzzle we're currently considering. ]
if the number of steps via the requiring relation from problem to job entry >= 0:
let candidate be job entry;
otherwise:
blank out the whole row;
sort Table of Temp Task Rankings in reverse puzz-rank order;
if puzzle-testing all:
repeat through table of Temp Task Rankings:
say "[line break]-->[job entry] : [puzz-rank entry] points";
say line break;
if candidate is nothing: [no way to guess; so just pick one at random.]
if puzzle-testing inferences, say "(no matches found; choosing at random)";
now candidate is a random unsolved thing required by problem;
[if what we picked is part of something unsolved, pick that instead.]
let parent be requiree of candidate;
while parent is sequential and parent is unsolved and parent is not problem and problem is not required by parent:
now candidate is parent;
now parent is requiree of candidate;
decide on candidate.
To score (points - a number) puzzle points for (selectee - a task):
if there is a job of selectee in Table of Temp Task Rankings:
choose row with a job of selectee in Table of Temp Task Rankings;
now puzz-rank entry is puzz-rank entry + points;
otherwise:
if the number of blank rows in Table of Temp Task Rankings > 0:
choose a blank row in Table of Temp Task Rankings;
now job entry is selectee;
now puzz-rank entry is points.
Table of Temp Task Rankings
| job | puzz-rank |
| a task | a number |
| with 20 blank rows. |