On one hand, undo is simple because time is linear: what state was I at such and such time? But if one goes backwards then does something different, one creates a tree, or a graph (achieving the same state two different ways.)
For each state, note the times one entered it, and the list of nodes and times one exited to (and came from, for reversible moves). Allow annotation of nodes with text and tags (the tags themselves can be organized in a DAG and queried).
When the final state is reached, review the shortest path.
Inspired by wanting a helpful user interface for a puzzle, e.g., sliding block puzzle.
No comments :
Post a Comment