Intelligent Hinting
version 5 by Aaron Reed
Section - Finding the Next Task
To decide which task is next task in (problem - a puzzle):
if problem is sequential:
if puzzle-testing all, say "(checking sequential puzzle [problem])";
repeat with req running through things required by problem:
if req is a task and req is unsolved:
[ say "(**deciding on [req]**)";]
decide on req;
otherwise if req is a puzzle and req is unsolved:
[ say "(**deciding on next task in [req]**)";]
decide on next task in req;
otherwise: [problem is not sequential ]
if puzzle-testing all, say "(checking not sequential puzzle [problem])";
unless saved endeavor is nothing: [problem is not sequential & something it requires is our saved endeavor.]
[ say "(saved endeavor: [saved endeavor])";]
let tmptask be saved endeavor;
unless problem is tmptask:
while tmptask is not required by problem:
now tmptask is requiree of tmptask;
[ say "(**[tmptask]**)";]
if tmptask is a task:
[ say "**tmptask deciding on [tmptask]**";]
decide on tmptask;
otherwise if problem is not tmptask:
[ say "**tmptask deciding on next task in [tmptask]**";]
decide on next task in tmptask;
[ say "**made it this far**";]
[If we've made it this far, we need to choose a new thing to do.]
if puzzle-testing inferences, say "(no saved endeavor: looking for recent actions/moves related to [problem])";
scour recent input for puzzle suggestions;
let candidate be the best choice of the ranked puzzles under problem;
if puzzle-testing inferences, say "(choosing [candidate])";
[If we've ended up with a task, we're solved; otherwise save our progress and recurse.]
if candidate is a task and candidate is unsolved:
now saved endeavor is candidate;
decide on candidate;
otherwise if candidate is a puzzle and ( candidate requires something unsolved or candidate requires something unsolved ) :
now saved endeavor is nothing;
now saved endeavor is next task in candidate;
decide on saved endeavor.