- Learn
- Tutorials
- Algorithms
- A* Search
- Appendices
- D Tuning Tables
Appendix D — Tuning Tables
The numbers that make 8-Puzzle Solver play the way it does. Change them to remix the game: the game’s Logic reads them from here. Try one change at a time, and run the game after each. If something stops working, put the old number back.
D.1 Data Tables
D.1.1 Board Layout
Where each drawing of a Board is on screen, one row each: “board” is the Board the player plays on, and “goalPicture” the small picture of the Goal. boardLeft and boardTop are the X and Y of the center of its Slot 0 (the top-left cell), in screen pixels from the top-left Screen Anchor: the numbers the Scene editor’s Screen Offset shows. +Y is up, so a Slot below the top edge has a negative Y. slotSpacing is the distance between the centers of two Slots side by side, in screen pixels.
187-260150694-31772D.1.2 Puzzle Settings
The puzzle as Board States: nine digits, one per Slot in reading order (Slot 0 is the top-left cell), with 0 for the Blank. startBoard is the Board the game opens with; goalBoard is the Board the player is trying to make. scrambleMoves is how many random legal Moves a New puzzle makes from the Goal.
54270381612345678012D.1.3 Messages
The words the player reads. Each row is one situation. words is what the Status Line shows, or a button’s words. pausedWords is what the Status Line shows instead while Solve is paused: “Paused” while a search or a Route is waiting for the next Step, and otherwise the same words. explanation is the sentence the Message Line shows in that situation: what each Step does now. The row “ready” is for when no search is under way; only its explanation is shown.
SolvedSolvedThe Route has been played: it is a shortest way from the Board the search began on to the Goal.Searching...PausedEach Step Expands the open Search State with the lowest Moves so far + Estimate (g + h).Try a new puzzle.Try a new puzzle.No Route: no Search State was left open, or the search grew too large.Building route...Building route...The Goal is accepted. Each Step copies one Route record, following the parents back.Solving...PausedThe Route is complete. Each Step plays its next Move.SolvePauseSlide a Tile beside the Blank, or press Step to search from this Board.D.1.4 Search States
The records of the A* search, one row per Board the search has found. Each row is named by its Board State, written as text (Board State 123405678 is row “123405678”). movesSoFar is how many Moves its stored route from the Board the search started from takes (g). estimatedMovesLeft is the Estimate of the Moves still needed to reach the Goal (h). parentState is the Board State that route came from (-1 for the Board the search started from). isOpen is Yes while the Search State is in the Frontier, and No once it has been Expanded. The table starts empty; the search fills it while the game runs, and a new row starts from the column defaults (no Moves, no parent, open).
D.1.5 Search Settings
How large a search may grow. maxStates is the most Search States the Search States table may hold; when a new one would not fit, the search stops.
4096D.1.6 Solution Route
The Route the search found, one row per Board on it, from the Board the search started from to the Goal. Each row is named by its Move number written as text: row “0” is the Board the search started from, and row “1” the Board after the first Move. state is that Board State. The table starts empty; building the Route fills it from the Goal back, one record per Step, and playing the Route reads it from row “1” on.
D.1.7 Estimates
The Estimates the search can use, one row each, named by the words the Estimate button shows. countsSlotsAway is Yes when each Tile out of place adds how many Moves it is from its Slot in the Goal (Manhattan distance), and No when each Tile out of place adds 1 (misplaced Tiles). Neither ever guesses more Moves than are really needed. next is the Estimate the button changes to.
YesMisplaced TilesNoManhattanD.2 Logic Numbers
The numbers and colors each Logic Component keeps in its Shared Variables and Per Instance Variables, with the Starting Value its card gives. A value set on its Object, under Variables in the Properties, or on a placement in the Scene, wins over the value here.
SOLVE TIMER
solveSeconds ............... 0.05
stepsPerTick ............... 8
SLIDE TO SLOT
slideSeconds ............... 0.22
