Carve a Pumpkin With Code
Experience: 1st year, 3rd quarter
Practice: Creating computational artifacts, Testing and refining computational artifacts, and Communicating about computing
Concept: Algorithms, Control, Modularity, and Variables
Length: 40+
Overview and Purpose
Coders continue to develop their understanding of pen blocks by creating algorithms to carve pumpkins. This purpose of this project is to reinforce understandings of how to draw shapes with code.
Preparation (25+ minutes)
Suggested preparation
(5+ minutes) Take some time to review how the code works in this resource.
Customizing this project for your class (10+ minutes): Remix the project example to include your own pumpkin carving code.
(10+ minutes) Read through each part of this lesson plan and decide which sections the coders you work with might be interested in and capable of engaging with in the amount of time you have with them. If using projects with sound, individual headphones are very helpful.
Download the offline version of Scratch: Although hopefully infrequent, your class might not be able to access Scratch due to Scratch’s servers going down or your school losing internet access. Events like these could completely derail your lesson plans for the day; however, there is an offline version of Scratch that coders could use when Scratch is inaccessible. Click here to download the offline version of Scratch on to each computer a coder uses and click here to learn more by watching a short video.
Resources for learning more
- BootUp Scratch Tips
- Videos and tips on Scratch from our YouTube channel
- BootUp Facilitation Tips
- Videos and tips on facilitating coding classes from our YouTube channel
- Scratch Starter Cards
- Printable cards with some sample starter code designed for beginners
- ScratchEd
- A Scratch community designed specifically for educators interested in sharing resources and discussing Scratch in education
- Scratch Help
- This includes examples of basic projects and resources to get started
- Scratch Videos
- Introductory videos and tips designed by the makers of Scratch
- Scratch Wiki
- This wiki includes a variety of explanations and tutorials
Getting Started (6-21+ minutes)
Suggested sequence
1. Review and demonstration (2-10+ minutes):
Begin by asking coders to talk with a neighbor for 30 seconds about something they learned last time; assess for general understanding of the practices and concepts from the previous project.
I recommend completing the “What Can You Create? - Drawing” project before beginning with this project; however, follow these steps if skipping that project:
Explain that today we are going to use code to automatically carve a pumpkin (make a carving without a user controlling the carving with their mouse or keyboard). Display and demonstrate the five example carvings in the sample project (or your own remixed version). Press number keys 1, 2, 3, or 4 to show alternative carvings to the carving that displays when the green flag is clicked.
If you HAVE completed the “What Can You Create? - Drawing” project:
Display the code for one of the carving examples in the example project without showing what it carves; for example. Ask the class to talk with a neighbor to see if they can figure out what the carving is going to look like just by looking at the code. After having a couple of groups volunteer what they think is going to happen, run the algorithm and compare and contrast what was predicted versus what happened. Take time by walking through each step of the code and make note of how the names of the functions (My Blocks) might help with understanding what an algorithm does. Repeat this process with a couple more of the example algorithms.
Resources, suggestions, and connections
Practices reinforced:
- Communicating about computing
Video: Project Preview (0:58)
Video: Lesson pacing (1:48)
This can include a full class demonstration or guided exploration in small groups or individually. For small group and individual explorations, you can use the videos and quick reference guides embedded within this lesson, and focus on facilitating 1-on-1 throughout the process.
Example review discussion questions:
- What’s something new you learned last time you coded?
- Is there a new block or word you learned?
- What’s something you want to know more about?
- What’s something you could add or change to your previous project?
- What’s something that was easy/difficult about your previous project?
2. Discuss (3+ minutes):
With the blocks displayed on the screen, have coders talk with each other about how else they might create a carving using the blocks displayed on the screen.
Practices reinforced:
- Communicating about computing
Video: Project Preview (0:58)
Video: Lesson pacing (1:48)
This can include a full class demonstration or guided exploration in small groups or individually. For small group and individual explorations, you can use the videos and quick reference guides embedded within this lesson, and focus on facilitating 1-on-1 throughout the process.
Example review discussion questions:
- What’s something new you learned last time you coded?
- Is there a new block or word you learned?
- What’s something you want to know more about?
- What’s something you could add or change to your previous project?
- What’s something that was easy/difficult about your previous project?
3. Remix the remix project (1-5+ minutes):
If not yet comfortable with logging in, review how to log into Scratch and remix this project with the pumpkin background and carving knife sprite.
If coders continue to have difficulty with logging in, you can create cards with a coder’s login information and store it in your desk. This will allow coders to access their account without displaying their login information to others.
Alternative login suggestion: Instead of logging in at the start of class, another approach is to wait until the end of class to log in so coders can immediately begin working on coding; however, coders may need a reminder to save before leaving or they will lose their work.
Why the variable length of time? It depends on comfort with login usernames/passwords and how often coders have signed into Scratch before. Although this process may take longer than desired at the beginning, coders will eventually be able to login within seconds rather than minutes.
What if some coders log in much faster than others? Set a timer for how long everyone has to log in to their account (e.g., 5 minutes). If anyone logs in faster than the time limit, they can open up previous projects and add to them. Your role during this time is to help out those who are having difficulty logging in. Once the timer goes off, everyone stops their process and prepares for the following chunk.
Project Work (40-100+ minutes; 1-2+ classes)
Suggested sequence
(optional) Reverse engineering shapes (60+ minutes):
Skip this introduction if you have already completed the “What Can You Create? - Drawing” project.
1+ minute intro demonstration
Display the first slide from the quick reference guide for one of the following example shapes:
- Square (slide 7)
- Rectangle (slide 10)
- Triangle (slide 13)
- Circle (slide 16)
4+ minute reverse engineering and peer-to-peer coaching
Ask coders to work independently or with a partner (great for younger coders) to see if they can figure out how to use their code blocks to create an algorithm that makes a sprite do something similar to what was demonstrated. Facilitate by walking around and asking guiding questions.
1+ minute hint demonstration
Move to the next slide in the quick reference guide that displays the same gif with two variables: one for the number of steps/blocks needed for each side (always 2) and one for the number of repeats (depends on the number of sides). Talk out loud how the number of sides correlates with the number of repeats and think through what kinds of blocks you might need (motion and turn).
4+ minute reverse engineering and peer-to-peer coaching
Continue to work independently or with a partner and facilitate by walking around and asking guiding questions. If coders figure out how to carve the shape, use some of the suggested guiding questions on the right to encourage them to experiment with the shape.
1+ minute collaborative demonstration
If coders figured out how to get their sprite to do something similar, have them document in their journal, share with a partner, or have a volunteer show the class their code and thought processes that led to the code. Otherwise, reveal the code on the third slide of each shape in the quick reference guide, walk through each step of the algorithm, and explain any new blocks.
5+ minute application and exploration
Encourage coders to try something similar, and leave your code up on display while they work. Facilitate by walking around and asking questions about how coders might change their code so it’s not the same as yours.
Resources, suggestions, and connections
Standards reinforced:
- 1B-AP-10 Create programs that include sequences, events, loops, and conditionals
- 1B-AP-11 Decompose (break down) problems into smaller, manageable subproblems to facilitate the program development process
- 1B-AP-15 Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intended
Practices reinforced:
- Communicating about computing
- Testing and refining computational artifact
- Creating computational artifacts
Concepts reinforced:
- Algorithms
- Control
Quick reference guide: Click here
Video: Suggestions for reverse engineering (4:25)
Note: It is not recommended to show each of these ideas at once, but to show one idea, give time for application and exploration, show another idea, give time for application and exploration, etc. This process could take multiple classes. Also, some of these examples may be difficult for young coders, so go slow and encourage copying and modifying code as it’s good practice.
Alternative suggestion: If reverse engineering is too difficult for the coders you work with, you could display the source code and have coders predict what will happen.
Suggested guiding questions:
- How many steps are there for carving a side of a shape (two - move and turn)?
- How many times do you repeat each step (depends on the number of sides)?
- What happens if you change the degrees to a different number?
- How can you make the shape larger or smaller?
- What happens if you combine shapes with other block combinations?
Potential discussion: There is not always one way to recreate something with code, so coders may come up with alternative solutions to your own code. When this occurs, it can open up an interesting discussion or journal reflection on the affordances and constraints of such code.
Facilitation tip: If younger coders are finding this challenge difficult, try the suggested unplugged lesson to help reinforce the concepts introduced in this project.
4. Carve a pumpkin with code (30+ minutes):
*5 minute review*
Review the steps for creating a shape using the quick reference guide or the how many sides and degrees project.
25+ minute coding time and 1-on-1 facilitating
Give coders time to add in a variety of algorithms to carve a pumpkin. If a coder finishes a particular carving, ask them to create more variations in their project.
If coders are stuck, walk through how the of slides in the quick reference guide are almost the same as the code in the sample project. Point out that we need to use a pen up block before moving to our next shape, and a pen down block before carving our next shape.
Standards reinforced:
- 1B-AP-10 Create programs that include sequences, events, loops, and conditionals
Practices reinforced:
- Testing and refining computational artifacts
- Creating computational artifacts
Concepts reinforced:
- Algorithms
- Control
Video: Challenge demonstration (1:40)
Quick reference guide: Click here
Scratch Tool How many sides and degrees? (Use this tool to figure out how many degrees you should turn to create a shape)
Facilitation Suggestion: Some coders may not thrive on this kind of challenge, so we can encourage them to use the Tutorials to get more ideas for the challenge; however, we may need to remind coders the suggestions provided by Scratch are not specific to our projects, so it may create some unwanted results unless the code is modified to match our own intentions.
A note on using the “Coder Resources” with your class: Young coders may need a demonstration (and semi-frequent friendly reminders) for how to navigate a browser with multiple tabs. The reason why is because kids will have at least three tabs open while working on a project: 1) a tab for Scratch, 2) a tab for the Coder Resources walkthrough, and 3) a tab for the video/visual walkthrough for each step in the Coder Resources document. Demonstrate how to navigate between these three tabs and point out that coders will close the video/visual walkthrough once they complete that particular step of a project and open a new tab for the next step or extension. Although this may seem obvious for many adults, we recommend doing this demonstration the first time kids use the Coder Resources and as friendly reminders when needed.
5. Clean up your code with functions (10+ minutes)
*5 demonstration and discussion*
Midway through the previous chunk, pull up the third slide of the quick reference guide. Talk through how it might be really confusing to try and figure out which part of the code is for which shape. Note we could use comments to clarify, but a better option is to create new blocks using My Blocks. These new blocks (functions) can be used repeatedly to carve our shapes.
Demonstrate how we can use a go to block before the new function (My Blocks) to call a shape multiple times to create different carvings in different locations. Use the quick reference guide as a tool for this discussion or display code you created.
5+ minutes to clean up their code and 1-on-1 facilitating
Leave your code on the screen and give coders time to clean up their code. Encourage peer-to-peer assistance and facilitate 1-on-1 as needed.
Standards reinforced:
- 1B-AP-10 Create programs that include sequences, events, loops, and conditionals
Practices reinforced:
- Testing and refining computational artifacts
- Creating computational artifacts
Concepts reinforced:
- Algorithms
- Control
- Modularity
Video: Clean up your code with functions (3:23)
Quick reference guide: Click here
Suggested questions:
- How do functions and comments help you understand the parts of a project?
- What’s the difference between the two?
- What other projects could you make easier to read by creating functions for each part of the code?
- When shouldn’t you use functions and just keep a longer algorithm?
6. Add in comments (the amount of time depends on typing speed and amount of code):
*1 minute demonstration*
When the project is nearing completion, bring up some code for the project and ask coders to explain to a neighbor how the code is going to work. Review how we can use comments in our program to add in explanations for code, so others can understand how our programs work.
Quickly review how to add in comments.
Commenting time
Ask coders to add in comments explaining the code throughout their project. Encourage coders to write clear and concise comments, and ask for clarification or elaboration when needed.
Standards reinforced:
- 1B-AP-17 Describe choices made during program development using code comments, presentations, and demonstrations
Practices reinforced:
- Communicating about computing
Concepts reinforced:
- Algorithms
Video: Add in comments (1:45)
Quick reference guide: Click here
Facilitation suggestion: One way to check for clarity of comments is to have a coder read out loud their comment and ask another coder to recreate their comment using code blocks. This may be a fun challenge for those who type fast while others are completing their comments.
Assessment
Standards reinforced:
- 1B-AP-17 Describe choices made during program development using code comments, presentations, and demonstrations
Practices reinforced:
- Communicating about computing
Although opportunities for assessment in three different forms are embedded throughout each lesson, this page provides resources for assessing both processes and products. If you would like some example questions for assessing this project, see below:
Summative (Assessment of Learning)
The debugging exercises, commenting on code, and projects themselves can all be forms of summative assessment if a criteria is developed for each project or there are “correct” ways of solving, describing, or creating.
For example, ask the following after a project:
- Can coders debug the debugging exercises?
- Did coders use a variety of block types in their algorithms and can they explain how they work together for specific purposes?
- Did coders include descriptive comments for each event in all of their sprites?
- Can coders explain how they used My Blocks (or even broadcast blocks) as functions to make their code more organized and easier to read (modularity)?
- Did coders only use the block types indicated in this challenge?
- Can coders look at an algorithm and predict what shape it might carve?
- Did coders include at least ## sprites with different combinations of the block types for this challenge?
- Choose a number appropriate for the coders you work with and the amount of time available.
Formative (Assessment for Learning)
The 1-on-1 facilitating during each project is a form of formative assessment because the primary role of the facilitator is to ask questions to guide understanding; storyboarding can be another form of formative assessment.
For example, ask the following while coders are working on a project:
- What are three different ways you could change that sprite’s algorithm?
- What happens if we change the order of these blocks?
- What could you add or change to this code and what do you think would happen?
- How might you use code like this in everyday life?
- See the suggested questions throughout the lesson and the assessment examples for more questions.
Ipsative (Assessment as Learning)
The reflection and sharing section at the end of each lesson can be a form of ipsative assessment when coders are encouraged to reflect on both current and prior understandings of concepts and practices.
For example, ask the following after a project:
- How is this project similar or different from previous projects?
- What new code or tools were you able to add to this project that you haven’t used before?
- How can you use what you learned today in future projects?
- What questions do you have about coding that you could explore next time?
- See the reflection questions at the end for more suggestions.