- Learn
- Tutorials
- Algorithms
- A* Search
- Appendices
- B Message Map
Appendix B — Message Map
8-Puzzle Solver is built on messages (Custom Events): one piece of the game announces something, and the pieces that care listen. This map shows every message in the game: who sends it, who it goes to, and who hears it. A message must be spelled exactly the same where it is sent and where it is heard; this is the place to check.
Two ways to send. Trigger Custom Event goes to everyone who listens (a broadcast). Trigger Custom Event on Object goes to one Object only; either the sender’s own Object (one Logic telling the next Logic on the same Object that its part is done) or the one Object a Shared Variable of its Object names (@self.puzzleRules).
B.1 Chains to Follow
Read each line left to right: a message, the Logic (in bold) that hears it and sends the next message, and at the end the Logic that hears the last one.
- tileChosen → Hand Moves → boardChanged → Run Search → cancelSearch → Run Search → pauseSolve → Solve Timer
- solvePressed → Solve Timer → pauseSolve → Solve Timer
- stepPressed → Solve Timer → stepDue → Solve Timer → takeStep → Run Search → pauseSolve → Solve Timer
- stepPressed → Solve Timer → pauseSolve → Solve Timer
- newPressed → New Puzzle → boardJumped → Run Search → cancelSearch → Run Search → pauseSolve → Solve Timer
- resetPressed → New Puzzle → boardJumped → Run Search → cancelSearch → Run Search → pauseSolve → Solve Timer
- estimatePressed → Choose Estimate → estimateChanged → Run Search → cancelSearch → Run Search → pauseSolve → Solve Timer
B.2 All Messages, in the Order the Build Adds Them
| Message | Sent by | Goes to | Heard by | Chapter |
|---|---|---|---|---|
| boardChanged | Hand Moves (on Puzzle Rules) | everyone who listens | Check Goal (on Puzzle Rules); Run Search (on Puzzle Rules); Solve Timer (on Puzzle Rules); Slide To Slot (on Tile) | 1 |
| slideFinished | Slide To Slot (on Tile) | the Puzzle Rules Object only | Hand Moves (on Puzzle Rules); Solve Timer (on Puzzle Rules) | 1 |
| tileChosen | Choose Tile (a Function, called by Tile Keys, Run Search, Click To Choose) | the Puzzle Rules Object only | Hand Moves (on Puzzle Rules) | 1 |
| goalAccepted | Expand Best State (a Function, called by Run Search) | the Puzzle Rules Object only | Run Search (on Puzzle Rules) | 2 |
| searchStopped | Expand State (a Function, called by Expand Best State); Expand Best State (a Function, called by Run Search) | the Puzzle Rules Object only | Run Search (on Puzzle Rules) | 2 |
| stepPressed | Run Search (on Puzzle Rules); Send When Pressed (on Puzzle Button) | the Puzzle Rules Object only | Solve Timer (on Puzzle Rules) | 2 |
| pauseSolve | Run Search (on Puzzle Rules); Solve Timer (on Puzzle Rules) | the Puzzle Rules Object only; its own Object only | Solve Timer (on Puzzle Rules) | 4 |
| solvePressed | Send When Pressed (on Puzzle Button); Solve Timer (on Puzzle Rules) | the Puzzle Rules Object only; its own Object only | Solve Timer (on Puzzle Rules) | 4 |
| stepDue | Solve Timer (on Puzzle Rules) | its own Object only | Solve Timer (on Puzzle Rules) | 4 |
| takeStep | Solve Timer (on Puzzle Rules) | its own Object only | Run Search (on Puzzle Rules) | 4 |
| boardJumped | New Puzzle (on Puzzle Rules); Slide To Slot (on Tile) | everyone who listens; its own Object only | Hand Moves (on Puzzle Rules); Run Search (on Puzzle Rules); Solve Timer (on Puzzle Rules); Slide To Slot (on Tile) | 5 |
| cancelSearch | Run Search (on Puzzle Rules) | its own Object only | Run Search (on Puzzle Rules) | 5 |
| estimateChanged | Choose Estimate (on Puzzle Rules) | its own Object only | Run Search (on Puzzle Rules) | 5 |
| estimatePressed | Send When Pressed (on Puzzle Button); Choose Estimate (on Puzzle Rules) | the Puzzle Rules Object only; its own Object only | Choose Estimate (on Puzzle Rules) | 5 |
| newPressed | Send When Pressed (on Puzzle Button); New Puzzle (on Puzzle Rules) | the Puzzle Rules Object only; its own Object only | New Puzzle (on Puzzle Rules) | 5 |
| resetPressed | Send When Pressed (on Puzzle Button); New Puzzle (on Puzzle Rules) | the Puzzle Rules Object only; its own Object only | New Puzzle (on Puzzle Rules) | 5 |
From here on, each message has a list of its own, under the chapter that adds it. The name in quotes is the Mode that sends or hears it. An Event with only one Mode has it under its Logic Component’s name, and a Function sends “when called”.
B.3 Chapter 1: Slide the Tiles
B.3.1 boardChanged
- Sent by Hand Moves (on Puzzle Rules), in “Ready”, to everyone who listens.
- Heard by Check Goal (on Puzzle Rules): “Check Goal”.
- Heard by Run Search (on Puzzle Rules): “Run Search”.
- Heard by Solve Timer (on Puzzle Rules): “Solve Timer”.
- Heard by Slide To Slot (on Tile): “Slide To Slot”.
B.3.2 slideFinished
- Sent by Slide To Slot (on Tile), in “Slide To Slot”, to the Puzzle Rules Object only.
- Heard by Hand Moves (on Puzzle Rules): “Hand Moves”.
- Heard by Solve Timer (on Puzzle Rules): “Solve Timer”.
B.3.3 tileChosen
- Sent by Choose Tile (a Function, called by Tile Keys, Run Search, Click To Choose), in “when called”, to the Puzzle Rules Object only.
- Heard by Hand Moves (on Puzzle Rules): “Ready”.
- Heard by Hand Moves (on Puzzle Rules): “While Sliding”.
B.4 Chapter 2: Step Through the Search
B.4.1 goalAccepted
- Sent by Expand Best State (a Function, called by Run Search), in “when called”, to the Puzzle Rules Object only.
- Heard by Run Search (on Puzzle Rules): “Run Search”.
B.4.2 searchStopped
- Sent by Expand State (a Function, called by Expand Best State), in “when called”, to the Puzzle Rules Object only.
- Sent by Expand Best State (a Function, called by Run Search), in “when called”, to the Puzzle Rules Object only.
- Heard by Run Search (on Puzzle Rules): “Run Search”.
B.4.3 stepPressed
- Sent by Run Search (on Puzzle Rules), in “Run Search”, to the Puzzle Rules Object only.
- Sent by Send When Pressed (on Puzzle Button), in “Send When Pressed”, to the Puzzle Rules Object only.
- Heard by Solve Timer (on Puzzle Rules): “Solve Timer”.
B.5 Chapter 4: Solve and Pause
B.5.1 pauseSolve
- Sent by Run Search (on Puzzle Rules), in “Not Started”, to the Puzzle Rules Object only.
- Sent by Run Search (on Puzzle Rules), in “Finished”, to the Puzzle Rules Object only.
- Sent by Run Search (on Puzzle Rules), in “Run Search”, to the Puzzle Rules Object only.
- Sent by Solve Timer (on Puzzle Rules), in “Solve Timer”, to its own Object only.
- Sent by Solve Timer (on Puzzle Rules), in “Running”, to its own Object only.
- Heard by Solve Timer (on Puzzle Rules): “Solve Timer”.
B.5.2 solvePressed
- Sent by Send When Pressed (on Puzzle Button), in “Send When Pressed”, to the Puzzle Rules Object only.
- Sent by Solve Timer (on Puzzle Rules), in “Solve Timer”, to its own Object only.
- Heard by Solve Timer (on Puzzle Rules): “Paused”.
- Heard by Solve Timer (on Puzzle Rules): “Running”.
B.5.3 stepDue
- Sent by Solve Timer (on Puzzle Rules), in “Solve Timer”, to its own Object only.
- Heard by Solve Timer (on Puzzle Rules): “No Tile Sliding”.
- Heard by Solve Timer (on Puzzle Rules): “Tile Sliding”.
B.5.4 takeStep
- Sent by Solve Timer (on Puzzle Rules), in “No Tile Sliding”, to its own Object only.
- Heard by Run Search (on Puzzle Rules): “Not Started”.
- Heard by Run Search (on Puzzle Rules): “Searching”.
- Heard by Run Search (on Puzzle Rules): “Building Route”.
- Heard by Run Search (on Puzzle Rules): “Playing Route”.
- Heard by Run Search (on Puzzle Rules): “Finished”.
B.6 Chapter 5: New Puzzles and Two Estimates
B.6.1 boardJumped
- Sent by New Puzzle (on Puzzle Rules), in “New Puzzle”, to everyone who listens.
- Sent by Slide To Slot (on Tile), in “Slide To Slot”, to its own Object only.
- Heard by Hand Moves (on Puzzle Rules): “Hand Moves”.
- Heard by Run Search (on Puzzle Rules): “Run Search”.
- Heard by Solve Timer (on Puzzle Rules): “Solve Timer”.
- Heard by Slide To Slot (on Tile): “Slide To Slot”.
B.6.2 cancelSearch
- Sent by Run Search (on Puzzle Rules), in “Run Search”, to its own Object only.
- Heard by Run Search (on Puzzle Rules): “Run Search”.
B.6.3 estimateChanged
- Sent by Choose Estimate (on Puzzle Rules), in “Choose Estimate”, to its own Object only.
- Heard by Run Search (on Puzzle Rules): “Run Search”.
B.6.4 estimatePressed
- Sent by Send When Pressed (on Puzzle Button), in “Send When Pressed”, to the Puzzle Rules Object only.
- Sent by Choose Estimate (on Puzzle Rules), in “Choose Estimate”, to its own Object only.
- Heard by Choose Estimate (on Puzzle Rules): “Choose Estimate”.
B.6.5 newPressed
- Sent by Send When Pressed (on Puzzle Button), in “Send When Pressed”, to the Puzzle Rules Object only.
- Sent by New Puzzle (on Puzzle Rules), in “New Puzzle”, to its own Object only.
- Heard by New Puzzle (on Puzzle Rules): “New Puzzle”.
B.6.6 resetPressed
- Sent by Send When Pressed (on Puzzle Button), in “Send When Pressed”, to the Puzzle Rules Object only.
- Sent by New Puzzle (on Puzzle Rules), in “New Puzzle”, to its own Object only.
- Heard by New Puzzle (on Puzzle Rules): “New Puzzle”.
