Lesson: Guessing Game
Time: 50+ mins
IntroductionLet’s play a game! In this lesson, students will create an interactive quiz, use the "ask" block for user input, and use the "if-then-else" block to check the answer.
: Ask the user a question and wait until the user responds. : Return the user’s answer to the last question the program asked. : Make the Actor repeat this loop until a true or false [boolean value] determines when the block should stop repeating the code inside it. : This is a comparison operator that returns true if the first value is equal to the second value, and returns false otherwise. : If the condition is true, then run the code inside the "if" section. Otherwise, run the code inside the "else" section. : Make the Actor disappear from the Stage. : Make the Actor appear on the Stage.
- Condition: A logical expression that evaluates to true or false
- Conditional statement: A type of statement that executes different parts of the code based on whether a logical expression evaluates to true or false.
- Use conditional statements
- Create an interactive quiz game
- Computers, laptops, or mobile devices (1 per student) with student account access to Tynker.com
Warm-Up (15 minutes)Introduce your students to real-world examples of conditional statements. Pair up students and ask them to fill in the blank:
- If it's raining outside, then ____.
- If ______, then I will go to soccer practice.
- If I have a quiz on Friday, then _____.
Activities (45 minutes)Facilitate as students complete all Guessing Game modules on their own:
1. Asking Questions Example (Example)
- Students will view a project of an alien asking questions. Students will need to manually type in their answer at the bottom the the screen.
- Tell students to click the red button to move on to the next module.
- In this DIY (do-it-yourself) project, students will follow step-by-step directions to program an alien Actor to ask a question and repeat the answer!
- This module introduces the "answer" variable, which is set whenever the user provides an answer to an "ask" block. Here, the "answer" variable is used to make the alien say he loves your favorite food.
- Did students finish early? Encourage them to make the alien ask more questions.
- Students will view a guessing game project where an alien asks the user to guess its number! Students will need to manually type in their answer at the bottom the the screen.
- In this DIY project, students will program a guessing game, similar to the one they viewed in the previous module.
- Activities include programming the alien to ask a question with answer options, and making the alien respond different to correct and incorrect answers.
- Explain to your students that the "answer" variable gains a new value every time the question is answered--the computer only "remembers" the last value they typed!
- In solve this puzzle module, students will need to program the spaceship to navigate!
- Give a hint: Tell students to include negative values (e.g., "-10").
- This module will demonstrate asking a question in Tynker and checking the user’s response. The context provided is a riddle.
- In this DIY project, students will apply concepts and code blocks from this lesson to create their own riddle!
- Activities include adding a background and a character, programming the character to say a riddle, and answering the riddle.
- Did students finish early? Direct their attention to the bonus section in "Step 11," which encourages students to make multiple Actors have a funny conversation before programming the Actor to ask a question.
- Students will view a ghost-clicking game, which they will create their own version of in the next module!
- Each ghost will disappear when students click (web) or tap (mobile) on them.
- In this DIY project, students will create a ghost game where the ghosts disappear when the user clicks (web) or taps (mobile) on them!
- Did students finish early? Direct their attention to the bonus activity in "Step 4" of the tutorial.
- Optional: Challenge your students to experiment with their code and make the ghosts come back. (Hint: Tell students to use a "show" code block)
Extended Activities (10 minutes)Ask your students...
- What did you enjoy about making your own question and answer programs?
- Can you think of other ways you can use the "ask and wait" code blocks?
- Who can give an example of a conditional statement? For example, "If it’s cold outside, then I will wear a jacket."
- True or false: The phrase, "I like to wear my jacket" is an example of a conditional statement. (False)
- CCSS-Math: MP.1
- CCSS-ELA: RF.1.1, RF.2.4, RF.2.4.A, RF.3.4.A, RF.4.4.A, RI.2.6
- CSTA: 1B-AP-10, 1B-AP-11, 1B-AP-15
- CS CA: 3-5.AP.12, 3-5.AP.13, 3-5.AP.17
- ISTE: 1.c, 1.d, 4.d, 5.c, 5.d, 6.b
These student-facing slide presentations help educators seamlessly run Tynker lessons in a virtual or physical classroom setting. Each lesson has its own set of slides that introduce the big ideas, suggest unplugged activities, and include a section for each activity module. While running lesson slides, you can switch back and forth between the activity, the slides, answer keys and other lesson materials.
A sample slide presentation is available for your review. Please log in to view all the class presentations available with your plan..
Loops and Animation
Creating a Scene
Jumping over Obstacles
Music and Animation
Instruments and Tempo
Message Driven Programming
Pop the Balloon
Animation with Movement