# Charting Game Decisions

Learn to create flowcharts

## Questions to investigate

• How can flowcharts support designing a program?

## Prepare

• Ensure SPIKE Prime hubs are charged, especially if connecting through Bluetooth.

• Ensure students have the Robotic Hand model built, which was used in the Claw Game lesson

## Engage

### (Group Discussion, 15 minutes)

Ignite a discussion with students about a decision they make each day. Let students list several examples.

Prompt students with an example. One decision might be what to eat for breakfast each morning. Discuss with students what are the factors that help determine what you eat for breakfast. This might include how hungry they are or how much time they have.

Let students chose their own example and write out a list of questions they might ask themselves to help make a decision.

Here is an example:

• I need to eat breakfast before school.

• Am I very hungry? Yes

• Do I have time to eat? Yes

• Do we have my favorite cereal? Yes

• I decide to eat a bowl of my favorite cereal.

Let several groups share their examples. Ask students to identify areas that might be a conditional statement. What conditions for deciding what to each exist for example? Ask students to also think about how the output or end would change if you had answered any questions differently.

## Explore

### (Small Groups, 45 minutes)

Students will explore creating flowcharts to document their program then create a stacking game program.

**Introduce Flowcharts**

Explain to students that the use of flowcharts to students as a tool to organize and plan their program. Flowcharts are used to organize and sequence an algorithm to help break down complex problems. Flowcharts are especially helpful when writing programs with conditional statements because it helps you map out the various paths the program can take if the conditions are met or not.

Introduce students to these common flowchart symbols, which they can use in their work. Consider providing a copy of the table to the students or posting somewhere in the classroom.

Work together to create a flowchart based on the engage activity. Share this flowchart with students to discuss what possible outcomes could occur.

Discuss the flowchart together as a group. Notice there is more than one outcome. The question we are asking is setting up a condition. Either we are hungry, making the condition true, or not, which makes it false.

Allow students time to complete their own flowchart from the example in the engage, practicing using the symbols provided.

Discuss the flowcharts as a group.

**Stacking Game**

Direct students to open a new project in the python programming canvas. Students should open their program from the Claw Game lesson. Students should connect their hub.

Challenge students to use their Robotic Hand for even more precise movements. Students should try to stack as many of the 2x4 bricks as possible in 3 minutes.

Explain to students that they need to create a flowchart for completing this challenge prior to starting. Students should write down the steps needed to move from the start (all bricks separated) to the end (all bricks stacked). Students can refer to their Claw Game program to help think about what needs to happen.

Example Flowchart:

Discuss the flowchart example with students. Point out where the conditional statement is and the fact that a while loop is included. Show the example flowchart if needed.

Have each student in the group take turns seeing how many bricks can be stacked on top of each other. Students can re-use the program from the Claw Game or create a new program.

Allow students time to complete the challenge.

## Explain

### (Whole Group, 15 minutes)

Discuss the challenge with students.

Ask students questions like:

• How would the flowchart help you create a program?

• What is difficult about creating flowcharts?

• How were you able to stack the bricks?

• Which part of the program is the conditional statement?

• What was difficult about this challenge?

## Elaborate

### (Small Groups, 15 minutes)

Challenge students to race.

Prompt students to time themselves playing the stacking game one more time. This time students stack and then unstack all their bricks. Allow groups of students to race against each other.

Allow students time to complete the challenge. Discuss the challenge together.

## Evaluate

### (Group Exercise, 15 minutes)

**Teacher Observation:**

Discuss the program with students.

Ask students questions like:

• What is the purpose of a flowchart?

• Why are the shapes for each section of the flowchart different?

• What happened when you tried to stack the bricks? What this an easy task?

**Self-Assessment:**

Have students answer the following in their journals:

• What did you learn today about using flowcharts?

• What characteristics of a good teammate did I display today?

• Ask students to rate themselves on a scale of 1-3, on their time management today.

• Ask student to rate themselves on a scale of 1-3, on their materials (parts) management today.

## Lærerstøtte

Students will:

• Understand how to use flowcharts in planning.

• Create flowcharts and write programs that follow them.

• SPIKE Prime sets ready for student use

• Devices with the SPIKE App installed

• Student journals

**CSTA**

2-CS-02 Design projects that combine hardware and software components to collect and exchange data.

2-AP-10 Use flowcharts and/or pseudocode to address complex problems as algorithms

2-AP-13 Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs.

2-AP-16 Incorporate existing code, media, and libraries into original programs, and give attribution.

2-AP-17 Systematically test and refine programs using a range of test cases.

2-AP-19 Document programs in order to make them easier to follow, test, and debug.