Lesson 8: Mini-Project: User Input Programs
50 minutes
Overview
Students will apply their new skills with variables to one of three open-ended mini-projects. Students will explore sample programs, create a plan for their own project, and program it from scratch.
Purpose
This lesson doesn’t introduce new skills or concepts, but instead gives students the opportunity to apply what they have been learning in a creative way.
Standards
AP - Algorithms & Programming
- 1B-AP-11 - Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process.
- 1B-AP-12 - Modify, remix or incorporate portions of an existing program into one's own work, to develop something new or add more advanced features.
- 1B-AP-15 - Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intended.
- 1B-AP-17 - Describe choices made during program development using code comments, presentations, and demonstrations.
Agenda
Objectives
Students will be able to:
- Create an interactive computer program that responds to user input.
- Use variables in conjunction with prompts.
- Use variables to hold words and phrases.
Preparation
-
Print the planning guide or distribute a digital copy to each student. Review it ahead of time in case you would like to make any modifications to fit your class.
-
Review the options in level 3 ahead of time to get familiar with the flow students will need to follow.
-
This lesson has the potential to stretch to multiple class periods. Consider scheduling implications ahead of time.
Links
Heads Up! Please make a copy of any documents you plan to share with students.
For the teachers
- CSF - Course F - Slides - Slides (Download)
- Mini Project: User Input Programs - Slides
- Mini Project: User Input Programs - Answer Key
- Teacher Sandbox Level - Resource
For the students
- User Input Programs - Activity Guide
Vocabulary
- Input - The information computers get from users.
- Prompt - A message on the computer screen that waits for input from the user.
- Variable - A label for a piece of information used in a program.
Teaching Guide
Warm Up (10 minutes)
Review
Display: Show “Reflect” slide
Reflect: How do sprites, behaviors, events, and text work?
Vocabulary
Display: Show “Vocabulary” slide
- Input - The information computers get from users.
- Prompt - A message on the computer screen that waits for input from the user.
- Variable - A label for a piece of information used in a program.
Display: Show “Review” slide
Do This: Using the lesson slides, review the concepts that students have explored so far in the course: sprites, behaviors, events, and text. Finally, review how prompts and variables work.
Prediction
Display: Show “Level 1 - Predict” slide
Do This: Have students read the provided code and make a prediction about what will happen. After pressing “Run”, provide time for students to reflect on anything they found interesting or that surprised them. You can also edit this code with your class in this standalone "sandbox" level.
One of the trickiest parts of learning variables is making sure that a variable’s label always matches. In this level, be sure that students notice the difference between the variable meal and the variable food. Students should understand that the best way to solve this would be to just use one variable, making sure the label always matches.
You can also walk your class through correcting the bugs in this program by using this Teacher Sandbox level with your projector.
Exploration
Display: Show “Level 2 - Exploration: Sample Programs” slide
Do This: Have students explore the sample programs in level 1. This can be done as a whole class with discussion, with pairs sharing a device, or even individually. For each of the programs, have students think about how it works, who would use it, and any ideas it gives them about what they could make themselves. A good strategy here is to have students read the program’s code out loud, one line at a time, then talk about what it is for.
If you are short on time or want to minimize transitions, complete this portion of the lesson as a whole group discussion. You can remind students that they can revisit these programs later if they have a question about how something works.
If you have already gone through the entire lesson yourself, you can also show them your own finished program for inspiration!
Main Activity (30 minutes)
User Input Programs
Remarks
We have already had a chance to build a variety of programs in Sprite Lab. Today, this experience will be much more open-ended, so it will require planning beforehand! Planning is a very important part of coding a game or any other kind of software.
Planning (10 mins)
Display: Show “Level 3 - Program Planning” slide
Remarks
Before writing any code, you will create a plan for your program.
Your completed plan should include:
- The type of project you're building.
- A list of questions you will ask the user.
- Any other text you will display.
- A description or drawing of the sprites you will need (and their behaviors).
Display: Show “Step 1 - Choose a Project Type” slide
Remarks
You will be choosing between three basic project types with different instructions. Each choice begins with different costumes but you can also add more any time.
Display: Show “Step 2 - Plan Your Text and Variables” slide
Remarks
This is an example of what you might write if you choose the “chatbot” option. For each word that comes from the user, circle it and then decide on the variable labels you will use in your program.
Display: Show “Step 3 - Plan Your Prompts” slide
Remarks
For each variable in your program, write a simple prompt (or question) that will tell the user what they need to do.
Display: Show “Step 4 - Sketch Your Scene” slide
Remarks
Create a two-panel storyboard for your program. Spend some time thinking about how you want your sprites to appear or move, both before and after the prompts are answered.
If you are short on time, it’s acceptable to have students just focus on the first page of the planning guide. Students can also re-use the same stories they completed during the "Blank Space Stories" lesson.
Mini-Project (20 mins)
Display: Show “Level 4 - On Code Studio…” slide
For each of the project choices, there are two sub-levels. To begin, pick one of the levels marked "Part 1". Once you finish that level, return here and select "Part 2" of the same project.
The first level for each choice will provide students with feedback as they put the basic components of their project together. The second level is a "free play" which is intended to allow students to make any changes to their code that they like.
Equipped with their completed planning guides, students are now ready to bring their projects to life. Transition students to their computers and ask them to start “Part 1” of their chosen project.
Display: Show “Give credit!” slide
Say: Sometimes when we create our own projects we find inspiration from other people’s projects.
If you have gotten permission to remix a project, make sure to give credit to the original coder.
If you remix a Code.org project:
- Add a comment block that explains where you remixed from.
- You might also keep the word “Remix” in the title of your project to tell others that this project originally came from someone else.
If you want to remix a friend’s project:
Make sure you get their permission first. Once you get permission, follow the steps above to give them credit.
When you don’t have direct permission to remix someone’s project or upload their images into your project, look for publicly available materials instead.
This level presents students with a menu of options that correspond to the main project types they chose from. The main differences between these sublevels are the instructions and default sprite costumes. Students may need really clear instructions to understand how to navigate the choices here. For each of the project choices, there are two sub-levels here. To begin, students should pick one of the levels marked "Part 1". Once they finish that level, they should return here and select "Part 2" of the same project. The first level for each choice will provide students with feedback as they put the basic components of their project together. The second level is "free play," which is intended to allow students to make any changes to their code that they like.
Wrap Up (10 minutes)
Showcase
Display: Show “Showcase” slide
Do This: To celebrate students' work, spend the last 10 minutes or so allowing them to showcase their projects. This can be done in many ways, but here are a few:
- Public Demo: Select a few exemplary volunteers to briefly demo their projects in front of the class. As they do so, have them touch on what the planning-to-coding experience was like for them, including ideas they'd still like to implement.
- Pair Playtesting: Have students or groups pair up and playtest each other's projects. As they do, ask them to provide positive and constructive feedback to each other. The benefit here is that students will have the opportunity to provide and respond to feedback in a smaller setting.
- Gallery Walk: Ensure all students have their projects ready for testing. Have students move "musical chairs"-style to another computer and play/test the project there for a few minutes, until they receive a signal from you to move to another computer. Repeat this every few minutes. While there is less opportunity for structured communication here, this ensures students get to demo as many of their peers' projects as possible.
This work is available under a Creative Commons License (CC BY-NC-SA 4.0).
If you are interested in licensing Code.org materials for commercial purposes contact us.