Day 4 Unit 2
Unit 1. Bug competition!
Let’s continue with “Squash the bug!” game we were working on.
As we said earlier, for natural selection to occur we need “variation” and “differential survival or reproduction”. We are going to introduce those elements to the game today.
If your game didn’t save properly or you want to start where we left off, this starter project has all the code from the last unit:
https://scratch.mit.edu/projects/317381247
Step 5:
A new type of beetle is in town!
Let’s create a cousin of our large beetles, called the small beetles. Duplicate your LargeBeetle sprite by right clicking on it and selecting “duplicate.” Rename your new sprite “SmallBeetle” and change the size of it so it really is a smaller. Then go to the costumes tab and change the colors of your new sprite to something unique!


Step 6:
Keeping track of small beetles!
Similar to step 3, we want to be sure to keep track of our small beetles too. Alter your code for the SmallBeetle sprite to use the “small beetles” variable instead of the “large beetles” variable.

Now it’s time to play the game!
- Click Share button on the top of the page.
- Click on +add to studio button at the bottom of the page
- Choose 2023 summer code camp
- Click okay
Wrap-up: Show your project
- click on your account name at the top right of the page.
- Select My Class
- Click on Class Studios – 2023 summer code camp
- Check out your friends projects!
Start playing your game and notice whether it’s easier to squish the small beetles or the large beetles. What happens to the numbers of small and large beetles as you continue playing the game? Which group do you think has a higher fitness or, in other words, is better able to avoid your squishing?
How do you think this population would evolve based on your findings?
What is the “variation” in our game?
How is the “variation” linked with differential survival and reproduction?