TutorialsCocktail Shaker Sort

Appendix D — Tuning Tables

The numbers that make Picture Puzzle 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 Slots

The board, one row per slot in reading order: Slot 1 is the top-left slot, and the slots count left to right, then top to bottom. Logic reads a row by its index, 0 for Slot 1. piece is the ID of the piece in the slot now; a piece is home when its ID equals the row index. startPiece is the starting arrangement that Reset puts back; Shuffle makes a new one. The table starts empty: Make Board adds one row for each slot when the game begins.

Data TableBoard SlotsData Structure: Board Slots Entry

D.1.2 Messages

The words the game shows. Each row is one situation; words is what the player reads. Most rows are sentences for the Message Line; sortButton and pauseButton are the Sort Button’s label while the sort is stopped and while it runs; forwardPass and backwardPass name the computer’s pass on the lesson panel, which also shows swapped and kept for the last comparison; uploaded and uploadFailed tell how Upload went.

Data TableMessagesData Structure: Messages Entry
Row 0reset
wordsReset.
Row 1selected
wordsChoose another piece.
Row 2solved
wordsPicture complete.
Row 3swapped
wordsSwapped.
Row 4kept
wordsKept.
Row 5invalid
wordsThis puzzle needs each home position exactly once.
Row 6paused
wordsPaused.
Row 7sortButton
wordsSort
Row 8pauseButton
wordsPause
Row 9forwardPass
wordsForward pass.
Row 10backwardPass
wordsBackward pass.
Row 11uploaded
wordsPicture loaded.
Row 12uploadFailed
wordsCould not open that image. Try a PNG, JPEG or WebP.

D.1.3 Outline Colors

The colors of the Outlines behind the pieces, one row per meaning: normal, focus (the keyboard focus and a pressed piece), selected (the first piece chosen), compared (the pair the computer compared last), settled (a slot outside the unsorted range). color is the color of the Outline for that meaning.

Data TableOutline ColorsData Structure: Outline Colors Entry
Row 0normal
color#46615a
Row 1focus
color#2579bc
Row 2selected
color#f3d49c
Row 3compared
color#e3b76d
Row 4settled
color#78b99a

D.1.4 Piece Counts

The piece counts the player can choose, one row per count, from the smallest to the largest (Make Board makes the board once for the last row); each Count Button names its row. gridSize is how many pieces fill one row of the board (the board holds gridSize x gridSize pieces). piecesColumn names the column of Pictures that holds a picture cut into that many pieces.

Data TablePiece CountsData Structure: Piece Counts Entry
Row 09 Pieces
gridSize3
piecesColumnpieces9
Row 125 Pieces
gridSize5
piecesColumnpieces25
Row 264 Pieces
gridSize8
piecesColumnpieces64

D.1.5 Pictures

The pictures the player can choose, one row per picture; each Picture Button names its row, and Upload uses the row Uploaded, whose Sprites hold the player’s own picture once it is uploaded. preview is the whole picture, shown beside the board and over it once the picture is complete. pieces9, pieces25 and pieces64 are the picture cut into 9, 25 and 64 pieces: frame N of each is the piece whose ID is N.

Data TablePicturesData Structure: Pictures Entry
Row 0Village
previewVillage Picture
pieces9Village Pieces 9
pieces25Village Pieces 25
pieces64Village Pieces 64
Row 1Forest
previewForest Picture
pieces9Forest Pieces 9
pieces25Forest Pieces 25
pieces64Forest Pieces 64
Row 2Harbor
previewHarbor Picture
pieces9Harbor Pieces 9
pieces25Harbor Pieces 25
pieces64Harbor Pieces 64
Row 3Uploaded
previewUploaded Picture
pieces9Uploaded Pieces 9
pieces25Uploaded Pieces 25
pieces64Uploaded Pieces 64

D.1.6 Sort Speeds

How quickly Sort runs the computer’s sort, one row per speed the player can choose. intervalSeconds is the time between two rings of the pictureSort timer; comparisonsPerTick is the most comparisons one ring asks for (each is one Step); slideSeconds is how long the two pieces of a computer swap slide, at that speed, whether the swap came from Sort or from Step.

Data TableSort SpeedsData Structure: Sort Speeds Entry
Row 0Slow
intervalSeconds0.4
comparisonsPerTick1
slideSeconds0.35
Row 1Steady
intervalSeconds0.06
comparisonsPerTick1
slideSeconds0.18
Row 2Fast
intervalSeconds0.0167
comparisonsPerTick16
slideSeconds0.07

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.

LAY OUT SLOT
  drawnSlotSide .............. 70
PLAYER EXCHANGE
  exchangeSlideSeconds ....... 0.22