< Modeling Animal Adaptations

Lesson 2: Animal Behaviors for Survival

50 minutes

Overview

In this CS and science-integrated lesson, students will use behaviors in computer science to represent animal survival behaviors. When students use behaviors in Sprite Lab, they are giving their sprite a set of instructions to execute over and over like an animation. First, students will try out different pre-defined behaviors, including migratory patterns for whales and butterflies, bird dances used to attract a mate, and fish traveling in groups. Then, students will practice modifying and coding their own animal behaviors.

Purpose

By using coding to model animal group behaviors, students can explore the patterns and dynamics of social animals in a hands-on and immersive way. This lesson encourages students to apply their coding skills in a meaningful and relevant context. Students will be able work creatively by choosing the backgrounds, sprites, and behaviors, allowing them to make unique projects.

CSTA K-12 Computer Science Standards (2017)
    • 1B-AP-10 - Create programs that include sequences, events, loops, and conditionals.
    • 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.
Next Generation Science Standards
      • 3-LS2-1 - Construct an argument that some animals form groups that help members survive.
      • 3-LS3-2 - Use evidence to support the explanation that traits can be influenced by the environment.
      • 3-LS4-2 - Use evidence to construct an explanation for how the variations in characteristics among individuals of the same species may provide advantages in surviving, finding mates, and reproducing.
      • 3-LS4-3 - Construct an argument with evidence that in a particular habitat some organisms can survive well, some survive less well, and some cannot survive at all.

Agenda

Objectives

Students will be able to:
  • Create an interactive animation using behaviors in computer science.
  • Develop models of behavioral adaptations with code.
  • Discuss similarities and differences in how animals move and behave.
  • Explain migration as a survival mechanism using scientific language.
  • Illustrate examples of increased survival in groups.

Preparation

  • Review and complete the online tutorial yourself.
  • Determine in advance which levels might be more challenging for students.
  • Review slides and decide on pacing between student work time and whole group instruction.
  • Provide writing materials for the warm-up reflection and wrap-up exit ticket.
  • Consider these related extension options (link) to explore after the last lesson.

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the teachers

Vocabulary

  • Adaptation - A change in an organism to better survive its environment
  • Behavior - A set of actions you want a sprite to perform over and over.
  • Code - (v) To write instructions for a computer
  • Event - An action that causes something to happen
  • Evolution - The change in the characteristics of a species over several generations
  • Migration - A long distance move an animal makes seeking a better environment

Teaching Guide

Warm-Up (10 minutes)

Think About It (5 minutes)

Display: Show “Think About It” slide

Do This: Read the two questions out loud. Allow students 2-4 minutes to think or write independently.

Prompts:

  • What are these animals doing?
  • What do the pictures have in common?

Goal: Students should start to notice that both pictures show animals moving in groups. This is a behavior for survival!

Turn & Talk (5 minutes)

Display: Show “Turn & Talk” slide

Discuss:

  • Why is this school of sardines acting like this?

Discussion Goals: Students should create an argument for why there is strength in numbers. This could include facts about how small sardines are, how easy it would be to catch a sardine on its own, how this swarming behavior confuses its predators, and that there is a smaller chance of being eaten or caught when they swarm.

Display: Show “Science & Coding” slide

Remarks

Last class, we learned about how over time, animals adapted special features to allow them to survive. In this class, we learn about special behaviors that animals adapted in order to survive.

Today, you will use sprite behaviors in code to model different animal behaviors.

Main Activity (30 minutes)

Coding Behaviors for Survival (30 minutes)

Do This: Have students move to their computers and sign in. Students will work through the levels at their own speed.

Circulate the room to support students. Encourage them to read the instructions carefully and click on the lightbulb for hints on each level if they get stuck.

Teaching Tip

Level 1 is designed to ensure that students are staying with the class and does not contain any code.

The slides for Levels 2-10 can be used to preview or review the students' independent work time. Or it may be helpful to advance the slides throughout the lesson to match the pace of your students as they work independently.

Display: Show “Level 1 - Behaviors Intro" slide

Level 1: Level 1 is an informational level comparing behaviors in nature with behaviors in computer science. Consider asking a student to read each section aloud and describe the pictures. Highlight for students that the behavior block is a green block connected to a sprite begins block. In this case, the block on screen shows the sprite moving swimming left and right.

Display: Show “Level 2 - Migration" slide

Level 2: Level 2 models whale migration. Students add a new block to the program that begins the behavior ‘moving NSEW with arrow keys’ After clicking the run button, the whale will move in the direction of the arrow keys pressed. Students can use the arrow keys below the playspace or on their keyboard. In order to pass the level, students should model that whales migrate north (up arrow key).

Display: Show “Level 3 - 4 - Behaviors in CS " slide

Levels 3-4: In Levels 3 - 4, students experiment with beginning and stopping behaviors. They can test out different behaviors to gain an understanding of how changing the code changes the animation of the bug sprites.

Display: Show “Level 5-7 - Dancing Birds " slide

Levels 5-7: Levels 5-7 use the natural bird dancing behavior to explore layering different behaviors with code. These three levels are linked, meaning students’ code will carry over from level to level so they can build on it. In level 5, students begin one behavior for the bird sprite. In level 6, they add a second behavior so the sprite is doing both behaviors at the same time. In level 7, students add a when key pressed event that triggers a third behavior for the bird sprite.

Teaching Tip

If students modify the code beyond repair they can use the Version History button and click Start Over to reset the code for that specific level. If the version history is started over on a linked level, the code will reset to the original code from the first linked level.

Display: Show “Level 8 - Speed" slide

Level 8: In Level 8, students can modify the speed of the behavior for each sprite. Although both sprites are using the same behavior, they are moving at the speed set in the code. This level compares the difference in behavior between the turtle and the cheetah to highlight the different needs of each animal.

Display: Show “Level 9 - Many Sprites" slide

Level 9: Level 9 demonstrates that when a behavior is assigned to one sprite, it applies to all sprites with the same costume. In this example, when one butterfly begins migrating, they all begin migrating.

Display: Show “Level 10 - Survival in Groups " slide

Level 10: In Level 10, students are able to set one sprite as the leader which other sprites will follow. This models a school of fish swimming together in a group for survival.

Wrap Up (10 minutes)

Reflect (10 minutes)

Display: Show “Wrap Up” slide

Discuss:

  • Why do bears hibernate in the winter?
  • If these bears lived in areas without a winter, how might they adapt to their new environment?
  • What would change about the bear?

Discussion Goal: Students should make the connection that bear hibernate because of less food in the winter, and if they lived in an area without winter, they probably would not hibernate. Example: The bear would get stronger because it won't lose weight hibernating during the winter.

Do This: Have students examine the picture of the hibernating bear. Read the prompt as well as the words in the word bank, out loud. Allow students 3-5 minutes to write their responses. Choose to share in partners or as a group.

Teaching Tip

The wrap-up includes a prompt for students to write a sentence. They can write in a journal, respond to a prompt in an online document or form, or even on a scrap paper or whiteboard. You might choose to collect their responses or discuss in pairs, small groups or as a whole class.

Remarks

Well done, coders!

Next time, we’ll learn how to edit behaviors and make our own. By the end of the next lesson, you will take on the challenge of imagining and coding a new animal adaptation!

Extension Opportunties

This module is a great introduction to computer science through the lens of science. Here are a few options to continue learning more about the CS concepts introduced in this module. We recommend pursuing these extensions after completing Lesson 3 in this module.

Content Corner

Science Content:

Computer Science Concepts:

Creative Commons License (CC BY-NC-SA 4.0).

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.