TutorialsDijkstra’s Algorithm

Appendix D — Tuning Tables

The numbers that make Weighted Maze 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 Maze Cells

One row for each cell of the map, in reading order: Cell 00 is the top-left cell, and the numbers grow to the right, then down. A cell’s number is its row’s position in this table, counting from 0. cost is what it costs to enter the cell (-1 is a Wall). distance is the cheapest cost found so far from the Camp (1000000 means not reached yet). parent is the cell that cheapest route came from (-1 for none). settled is 1 once the cell’s distance is final. routeOrder is the cell’s place on the finished Route, counted from the Tower (-1 when it is not on the Route). The costs written here are the supplied map: Restore Defaults puts them back while the game runs.

Data TableMaze CellsData Structure: Maze Cells Entry
IMPORT CSV120 rows, from a file
FIRST ROWS3 of 120, to compare
Row 0Cell 00
cost1
distance1000000
parent-1
settled0
routeOrder-1
Row 1Cell 01
cost1
distance1000000
parent-1
settled0
routeOrder-1
Row 2Cell 02
cost1
distance1000000
parent-1
settled0
routeOrder-1

D.1.2 Maze Settings

The rules of the map. columns is how many cells a row of the map holds. rows is how many rows the map has; columns times rows must be the number of Maze Cells rows. startCell is the Camp’s cell and goalCell the Tower’s. maxCost is the largest cost a cell may have. unreached is the distance a cell has before the search reaches it; it is larger than any real route can cost. tickSeconds is how long Find route waits between two Steps.

Data TableMaze SettingsData Structure: Maze Settings Entry
Row 0rules
columns12
rows10
startCell0
goalCell119
maxCost99
unreached1000000
tickSeconds0.045

D.1.3 Maze Layout

Where the map is drawn, in screen pixels. originX and originY are the center of Cell 00 (the top-left cell), measured right and down from the top-left corner of the screen, the numbers the Scene editor shows. spacing is the distance between the centers of two cells side by side; it is the width a Map Cell is drawn (64 px), so the cells touch. slideSeconds is how long the Marker takes to move one cell. markerOffset is how far right of and below its cell’s center the Marker stands, so it sits on the cell’s lower-right corner. campFrame and towerFrame are the Terrain Tiles pictures drawn on the Camp and the Tower.

Data TableMaze LayoutData Structure: Maze Layout Entry
Row 0board
originX56
originY154
spacing64
slideSeconds0.2
markerOffset16
campFrame4
towerFrame5

D.1.4 Terrains

The four kinds of cell the learner can paint. cost is what entering that cell costs (-1 means a Wall, which cannot be entered). frame is its picture in Terrain Tiles. A cell whose cost matches no row is drawn as Road.

Data TableTerrainsData Structure: Terrains Entry
Row 0Road
cost1
frame0
Row 1Forest
cost3
frame1
Row 2Mud
cost6
frame2
Row 3Wall
cost-1
frame3

D.1.5 Messages

Every line the Status text can show. Each row is one situation; words is what the player reads. ready shows when the map opens and after every Reset, before the first Step. cellSettled goes between the name of the cell just settled (its Maze Cells row) and its distance, as in “Cell 52: cost 8”. noRoute shows when the search runs out of reached cells before the Tower is settled. wrongMapSize, wrongSettings, wrongEndpoints, wrongCost and blockedEndpoint are the input rules Check Maze Input asks before a search begins; their words name what to fix. buildingRoute shows when the Tower is settled, followRoute when the whole Route is traced, and invalidRoute when a traced link cannot be trusted. noCost is what the Cost readout shows until the Tower is settled. cheapestRoute shows when the Marker has walked the whole Route to the Tower. searching shows when Find route starts or goes on, and paused when the learner pauses it with the Find route button. findCaption and pauseCaption are what the Find route button reads while Find route is stopped and while it runs.

Data TableMessagesData Structure: Messages Entry
Row 0ready
wordsPaint terrain.
Row 1cellSettled
words: cost
Row 2noRoute
wordsNo route.
Row 3wrongMapSize
wordsFix columns and rows.
Row 4wrongSettings
wordsCheck search settings.
Row 5wrongEndpoints
wordsCheck start and goal.
Row 6wrongCost
wordsUse costs 0 to maxCost.
Row 7blockedEndpoint
wordsUnblock S and G.
Row 8buildingRoute
wordsBuilding route...
Row 9followRoute
wordsFollow the route.
Row 10invalidRoute
wordsInvalid route.
Row 11noCost
words--
Row 12cheapestRoute
wordsCheapest route.
Row 13searching
wordsSearching...
Row 14paused
wordsPaused.
Row 15findCaption
wordsFind route
Row 16pauseCaption
wordsPause

D.1.6 Directions

The four directions in which a cell has neighbors, in the order the search looks at them: Up, Right, Down, Left. columnStep and rowStep say how many columns and rows away the neighbor is. Rows count down from the top row of the map, so Up is rowStep -1.

Data TableDirectionsData Structure: Directions Entry
Row 0Up
columnStep0
rowStep-1
Row 1Right
columnStep1
rowStep0
Row 2Down
columnStep0
rowStep1
Row 3Left
columnStep-1
rowStep0

D.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.

CHOOSE TERRAIN
  chosenTint ................. #dab674
  plainTint .................. #ede2cd
STEP TRIAL
  maxCostLimit ............... 99
  unreachedLimit ............. 1000000000
SHOW SEARCH OUTLINE
  frontierTint ............... #32e9ed
  settledTint ................ #64afff
  currentTint ................ #ffffff
  routeTint .................. #ffe043
SHOW ROUTE LINE
  lineTint ................... #ffeb55