How-to
Play the three-stage stories
Keep tool indices, retry and stage state in the native rule namespace.
Choose one of two tools
import { choiceStory } from "@johnmorrisdotca/karakuri";
let state=choiceStory.newStory(0);
const stage=choiceStory.stageOf(state);
state=choiceStory.choose(state,stage.right);
console.log(stage.problem,stage.tools,state.stage,state.status);rain [ 'umbrella', 'sunglasses' ] 1 playingA story has three stages. Tool indices are 0 or 1. The right tool advances; a failed stage follows the native retry behavior and slip counter. The level collection is STORIES, while the player’s level number is one-based. Keep rules/state separate from the localized scenes and tool artwork.
The existing Choice Story guide retains every rule and stage contract. Its root namespace remains unchanged; the controller uses that same implementation.