There is more to being a writer than good spelling and grammar. Some students may wonder why they should write separate functions for safe-left? and safe-right? when onscreen? could just check the dimensions of the screen directly. Note: the volunteer for onscreen? should first call safe-left?, before replying with the value. Do this for all three functions, and have the class practice calling them with different values as well.
#Puzzle express license name and code code
That student should return "true", since the code currently returns true for all values of x. For example, "safe-left? fifty" means that the number 50 is being passed into safe-left?. Practice calling each function, by saying their name and then giving them an x-coordinate. If they get stuck, remind them that all of this information is written in their Contract! Ask each student to tell you their Name, Domain and Range. It’s extremely valuable in this stage to have three students stand, and act out each of these three functions: If Sam makes it all the way off-screen when he shouldn't, they'll get an error, but if he is successfully stopped they'll succeed and move to the next puzzle. Students will start by writing functions to check the left and right side of the screen independently, before combining those with a single onscreen? function that prevents Sam from leaving on both the left and right.įor each stage, make sure students try to get Sam to leave through the side they are checking. If the function returns false, Sam isn't allowed to move. That function should return true if part of Sam will still be visible, or false if he would go too far off-screen. In this stage students write functions that will take in Sam the Bat's next x-coordinate and a return a boolean. The screen size is 400 pixels by 400 pixels, so how far can Sam go before he starts to leave the screen?
#Puzzle express license name and code free
This is Sam the Bat, and his mother tells him that he's free to play in the yard, but he don't set foot (or wing) outside the yard! Sam is safe as long as he is always entirely onscreen. Onscreen? Design Recipe (in the student workbook).Safe-right? Design Recipe (in the student workbook).
Safe-left? Design Recipe (in the student workbook).Teaching Guide Materials, Resources, and Prep For the Student