Unit 6 Lesson 6 Puzzles 12-16 Example Solutions?


Are there example solutions for Unit 6-Lesson 6 Puzzles 12-16? I’m struggling to figure several out. I’m having flashbacks to my six-week condensed C++ course from 15 years ago when the teacher jumped from pretty much showing us code and making us imitate it into creating an entire program ourselves with no real understanding of what we were doing. I’m afraid my students are going to also struggle here as I don’t feel like the previous puzzles have gotten at the root of really explaining how the event handlers are working and how the different parts of the program are working in tandem, or at least I’m not really understanding it. Or I’m just slow, which is also a distinct (and likely true) possibility. :slight_smile:



Let me see if I can give you just a bit of guidance to set you on the right path. For the most part these levels already have the programming patterns you need in the starter code, but you need to identify the pattern and apply it elsewhere in the program.

6.12 - The puzzle is asking you to apply the same logic that’s currently in the buttonL event handler to the slider event handler. Look at the code on lines 6-7.
6.13 - The function updateLED (starting on line 12) uses a conditional to check the state of the toggle switch before decided whether or not to blink the LED. The function updateBuzzer (starting on line 20) should use that same logic.
6.14 - This is a pretty tough one, as there are some bugs in the code. You’ll need to read the code pretty closely to find them - use the previous two levels for reference.
6.15 - The buttonL event handler is the pattern you’re trying to replicate - create a handler for buttonR that follows the same pattern but moves the image up instead of down.
6.16 - You’re on your own now to add sliders that control how fast the motorcycle moves - look back to 6.12 and 6.13 for reference.

I’m purposefully being a bit vague to avoid giving away answers on the public forum - if you want to dig deeper PM me.