Director's Undo Reel
The trailer editor lost its safe undo controls! Package every edit as a reversible command, then protect the movie's history.
π§ Before we start
At the Sakura gate, tiny marks remembered which visitors might have arrived. Today, a command remembers one edit and how to reverse it. History works like a stack: the newest edit is always the first one undone.
Build three command cards
Tap each movie edit in the requested order. Every card must remember both its action and its matching reverse.
Undo the director's mistake
The car covers the final shot. Undo edits newest-first until only the hero's move remains, then redo one lighting edit.
HISTORY Β· NEWEST ON TOP
REDO SHELF
Create a new ending
One old edit is waiting on the redo shelf. The director now records a brand-new car edit. Decide what must happen to the old redo path.
saved
saved
CURRENT MOVIE
OLD REDO SHELF
Debug the shared snapshot
Two history cards point to the same scene snapshot. Changing the latest card secretly changes the older one too. Choose the safe repair.
π What you learned
- The command pattern packages an action together with the information needed to reverse it.
- An undo stack removes the newest command first: last in, first out.
- Redo keeps undone commands on a second stack and reapplies them in reverse order.
- A brand-new edit clears the old redo path because the history has branched.
- Independent snapshots stop newer changes from mutating old history.