- Learn
- Tutorials
- Algorithms
- Cocktail Shaker Sort
- Appendices
- E Troubleshooting
Appendix E — Troubleshooting
Every chapter’s If it didn’t work names the slips most likely in that chapter, and how to find each one. Here they are together, chapter by chapter.
Two checks find most of them. First, names must match exactly: a message, a timer or a table row is matched letter for letter, capitals included. Second, compare with the chapter’s game. Every chapter’s Goal holds the game as it is at the end of that chapter, and its catch-up download is that chapter’s finished project. Play it next to yours.
E.1 Chapter 1: The Picture and the Board
No pieces at all, but the title and the Preview are there? Perhaps Make Board never ran. Look for Puzzle Rules in Picture Table, and for Make Board on it, with Piece Outline and Piece in its two boxes. Open Make Board too, and look for a block standing apart from its line. Join it with Connect to Sequence.
All the pieces piled in one corner? They were made, but they never moved to their slots. Perhaps they never heard placedOnBoard. Look at the name in two places, Make Board’s Trigger Custom Event on Object and Lay Out Slot’s When bar. They must match, capital B and all. Or Slot Center may hand back its starting 0s. In Slot Center’s Return, x should say centerX, and y should say centerY.
Only one piece, or only one Outline? The Actions belong inside the Repeat, on its line, where the card puts them under Each time. One left outside runs once, not once for each slot.
The pieces are nowhere to be seen, though Make Board looks right? They may have gone into the game world, far off the screen, where no player would ever find them. Look at Lay Out Slot’s Set Position. Its Position Relative To should say Screen. Or perhaps the board sits above the screen, with every y the wrong way up. Look for the minus sign at the front of centerY, in Slot Center.
Every piece shows the same corner of the picture? Then every Piece is reading 0. Perhaps the rows never got their pieces. Look at Make Board’s first Repeat, and the two Set Data Cells inside it. Or look at Show Piece’s Set Frame, and its formula.
The caption says 0 / 0? Look at $gridSize in your Global Variables. Its Default is 8.
N and R do nothing? Look in the Input Manager first, for both Commands and their keys. After that, look for Puzzle Commands on Puzzle Rules, and at Arrange Board’s two When bars. Their names must match what Request Reset and Request Shuffle send.
The caption changes, but the pieces don’t? Show Piece may hear only one of its messages. Its second Event is boardArranged.
A button does nothing when you click it? Its UI Interaction may have gone with the others, so look in Attached Components. Then look at its Command Variable and the Object’s puzzleRules Shared Variable.
E.2 Chapter 2: Your Hands on the Board
The edges never change color at all? Perhaps no one hears selectionChanged. Look for Show Outline on the Piece Outline, in its Attached Logic. Check the message’s name in Show Outline’s When bar, and in Piece Press, capital C and all.
A press turns nothing blue? The press may never reach Puzzle Rules. Look at Piece Pointer on the Piece, and at the Piece’s puzzleRules Shared Variable. Then look for Piece Press on Puzzle Rules.
The gold appears, but the second tap selects instead of trading? Player Exchange may never have switched. Look at the Switch Mode at the end of Nothing Selected, which should name One Selected. Or the two Modes may have their Actions the wrong way round.
The pieces trade, but your next tap doesn’t turn a piece gold? Then pieceChosen is still in One Selected. Look at the Switch Mode just before One Selected’s Clear Selection. It should name On Piece Chosen and Nothing Selected.
Moves counts, but the pictures don’t change? Show Piece needs its third Event, piecesExchanged. If the pictures change but the caption doesn’t, Pieces Home needs the same Event.
A drag does nothing, though a tap works? Look at Piece Press’s pieceReleased, and its If inside an If. The drag is the inner If’s Else.
A press stays blue after you let go outside the board? Look at Piece Press’s End Step. It needs both Modes, and Release Seen switches back to No Release at its end.
The arrows move the focus the wrong way, or by a whole row? Check each arrow Event’s distance. Up and Down are a whole row, $gridSize, with a minus sign in front for Up.
E.3 Chapter 3: The Computer Compares
Step does nothing at all, and the counters stay at 0? Perhaps the request never arrives. Check Request Step’s stepRequested, and the name in Computer Sort’s When bar, capital R and all. Look for Computer Sort on Puzzle Rules. If Space works but the button doesn’t, look at the Step button’s Command Variable, which should say Step.
The bottom line says This puzzle needs each home position exactly once, on an ordinary board? Then Check Board Valid is answering false. Check isValid’s Declare Variable, starting true. Look at Count Piece Copies’ Return, whose Value is copies. And look at the If in Check Board Valid, which turns isValid false on !=, not on ==.
Comparisons counts, but nothing ever swaps? Look at the If in Compare Next Pair, where the comparison is > and the left side reads leftSlot.
Swaps counts, but the pictures don’t change? Show Piece needs its fourth Event, pairCompared. If the pictures change but the caption doesn’t, Pieces Home needs the same Event.
No amber anywhere? Look for Show Outline’s pairCompared Event. Then look at Color Outline’s last If, and its joined tests. If amber shows on the wrong slots, check $comparedSlot + 1 in that condition.
Does the amber ever move? Fresh may never switch to Forward Pass. Look at the Switch Mode at the end of Fresh’s If. Or Forward Pass may read leftSlot as $comparedSlot instead of $comparedSlot + 1.
The pass runs on past the end of the board, or stops before it gets there? Look at Forward Pass’s If, $comparedSlot + 1 == $rangeEnd, and at $rangeEnd in Fresh, with its - 1.
The counters don’t go back to 0 after Reset? Look at Computer Sort’s boardArranged Event, and at Clear Sort’s first two steps.
E.4 Chapter 4: The Way Back
Step goes quiet after the 63rd Step? Perhaps Forward Pass never switches. Look at the two Ifs inside Forward Pass’s If, which read forwardPassEnd.value: false switches to Finished, and true to Backward Pass. Does Finish Sort Pass return sortGoesOn? And look at its If, whose tests are joined by ||, meaning or.
Does the amber jump after the turn? Look at Backward Pass’s leftSlot, $comparedSlot - 1, with a minus.
The way back runs past the start of the board, or stops early? Look at Backward Pass’s If, $comparedSlot == $rangeStart, with no + 1 this time.
Every pass is the full length of the board? Then the range never moves in, so look at the Operators in both passes. Forward Pass takes 1 away from $rangeEnd with -=, and Backward Pass adds 1 to $rangeStart with +=.
The sort stops too soon? Perhaps Finish Sort Pass thinks the pass made no swaps. Look at where each pass writes $swaps into self.computerSortData.swapsBeforePass. It’s the last step in the If, after Finish Sort Pass, never before it.
No green anywhere? Look for Show Outline’s passFinished Event, and for the settled row in Outline Colors. If everything outside the amber turns green at once, look at Color Outline’s new Ifs: the first asks < against $rangeStart, and the second > against $rangeEnd.
The picture is complete, but Step still adds comparisons? Look at Computer Sort’s Variable Changed Event, the one that watches piecesHome.
E.5 Chapter 5: The Finished Puzzle
Pieces jump instead of gliding? Look for Slide Piece on the Piece, and at its first If, which compares the Piece’s slot with $slideFrom and $slideTo. If a piece glides from the wrong place, look at otherSlot’s second step, inside the small If.
A piece glides and then stands a little off its slot? Look at the two Tween Actions. One is position.x, the other position.y, and each Target reads home.
Pieces stop answering after the first exchange, and never wake up? Perhaps the cooldown never ends. Look at Slide Pieces’ Start Cooldown, whose Seconds is seconds. Then look at the name pieceSlide on every card that asks for it. It should be spelled the same each time, with the same quote marks the card shows.
Sort does nothing? Look at the Sort button’s Command Variable, Sort, and Button Action’s Request Sort call. Next, look at Sort Timer’s sortRequested Event, and check that its Stopped Mode is the one it starts with.
Sort runs a few Steps and stops? Perhaps the ring calls Request Step, which pauses the sort. The ring sends stepRequested itself.
The button never reads Pause? Look at Start Sort Timer’s last step, and at the Sort button’s Text, {$sortButtonLabel}.
The sort finishes, but the button still says Pause? Look for each sortEnded in Computer Sort, two of them in the passes’ small Ifs, and for Sort Timer’s sortEnded Event.
Pressing 9 leaves 64 small pieces on the board? Look at Lay Out Slot’s boardArranged Event, and at Lay Out One Slot’s If. If nine pieces show the wrong pictures, look at Choose Piece Sprite.
Nothing on the board answers, ever? Perhaps the Puzzle Controls are off. Look at the INPUT CONTEXTS: Puzzle Controls is active at start, and Lesson Panel Controls isn’t. And look at the spelling of Puzzle Controls in each Check Input Context Active.
The panel never closes? Look for Close Panel in the Lesson Panel Controls, not in Puzzle Controls.
Upload opens no chooser at all? Perhaps a mark went missing in the program. Open the catch-up download, and go down its Run Code (JS) box beside yours, line by line.
