1 of 17

The Arizona STEM �Acceleration Project

Year 2024- 2025

2 of 17

Mrs Martinez’s Ogres and Oubliettes Game in Flowgorithm

– an adventure game in the style of

D&D

Code an if/then text based adventure game with Flowgorithm.

Flowgorithm is a unique coding environment different from Scratch because it uses core coding concepts of flowcharts to demonstrate working code.

This is a truncated/abbreviated glimpse of the games we make in class.

This game is built after a month of introduction to coding concepts and is described in brief here for inspiration.

Amy Martinez

images create in chatGPT 5/3/25 with prompts that include title, flowchart, fun and binary

A High School STEM Lesson

The Arizona STEM Acceleration Project

3 of 17

Notes for teachers

“Flowgorithm is a graphical authoring tool which allows users to write and execute programs using flowcharts. The approach is designed to emphasize the algorithm rather than the syntax of a specific programming language.[1] The flowchart can be converted to several major programming languages. Flowgorithm was created at Sacramento State University.[2]

https://en.wikipedia.org/wiki/Flowgorithm

4 of 17

List of Materials

Materials

Flowgorithm must be downloaded and installed onto computers in lab. There is no cloud access currently. Please talk to your IT department if needed.

Link to download flowgorithm:

http://www.flowgorithm.org/download/

5 of 17

Standards

CTE Engineering Standards:

STANDARD 3.0 APPLY MATHEMATICAL LAWS AND PRINCIPLES RELEVANT TO ENGINEERING TECHNOLOGY

—3.1 Use basic mathematical functions and tools (i.e., Google Sheets, Excel, graphing calculator, etc.)

Math Standards:

Creating Equations (A-CED)

A1.A-CED.A Create equations that describe numbers or relationships.

A1.A-CED.A.1 Create equations and inequalities in one variable and use them to solve problems. Include problem-solving opportunities utilizing real-world context. Focus on linear, quadratic, exponential and piecewise-defined functions (limited to absolute value and step).

A1.A-CED.A.2 Create equations in two or more variables to represent relationships between quantities; graph equations on coordinate axes with labels and scales.

A1.A-CED.A.3 Represent constraints by equations or inequalities, and by systems of equations and/or inequalities, and interpret solutions as viable or non-viable options in a modeling context.

6 of 17

Objectives:

Learning Objective:� Apply mathematical logic and principles—such as Boolean operations (AND, OR)—within coding structures (variables, selection, and loops) to develop an interactive game scenario, such as a battle between a player and an ogre.

Students will be able to:

  • Identify and use basic variable types: String, Boolean, Integer, and Float.
  • Correctly declare and initialize variables (e.g.,
    • Integer score;
    • score = 0;
  • Write and organize code using sequential flow, conditional selection (if/else), and loops (while/for).
  • Apply logical operators (AND, OR) to build decision-making logic that controls game flow.
  • Integrate all concepts into a simple interactive game feature, such as a turn-based combat system between a player and an ogre.

7 of 17

Agenda

At this point, we have had at about 3 weeks of intro to coding concepts and basic use in flowgorithm. But students have been told since the beginning that this D&D style game is their goal.

This particular lesson, building the game fight sequence, takes 1-2 class periods of about 55 minutes each.

For Fast Finishers:

Students who finish early can add game play and output texts to their game to make it more interesting. More game functionality is added as the semester progresses.

8 of 17

Intro/Driving Question/Opening

Description:

In this lesson, we explore how math concepts—like the number line and logical conditions using AND and OR—help us write smarter code. In math, we use AND when both conditions must be true (e.g., a number is greater than 0 and less than 10), and OR when either condition can be true (e.g., a number is less than 0 or greater than 100).

In coding, especially when using IF statements and LOOPS, we apply these same ideas to control what our program does next. This is called selection—our code "selects" what to do based on the conditions we set. If the right conditions are met, the code runs a certain block; if not, it chooses something else. The same logic applies when using WHILE loops: we use AND and OR structures to evaluate conditions, which return a simple Boolean value—TRUE or FALSE—that tells the program whether to continue.

We’ll use these logical tools to make decisions in our game, like whether the player has enough health to attack again AND the ogre still has enough health to fight back.

9 of 17

Hands-on Activity Instructions

  • Programming is done in pairs
  • Follow the layout initially for inspiration
  • Images are provided
  • So many aspects can be added after this fight sequence such as
    • Put fight sequence into function
    • Store scores in an array
    • use turtle graphics
    • etc..

Once code is created in flowgorithm, you can use the source code viewer to translate it into other languages.

10 of 17

Ogre’s and Oubliettes Fight sequence: Player vs Ogre

*extremely simplified version for inspiration*

First we need to declare 2 integer variables

–playerHealth

–ogreHealth

Then we initialize them to 5 health points each:

Upon creating a new file, you will see the main function and the end of the main function in a flowchart.

Right click on the flowchart line to add variables, selections, etc..

11 of 17

Ogre’s and Oubliettes Fight sequence: Player vs Ogre

*extremely simplified version for inspiration*

Add another variable called roundCount to

keep track of the rounds in our match up.

Add variable to hold a random number which will

decide if the player and ogre land hits.

12 of 17

Ogre’s and Oubliettes Fight sequence: Player vs Ogre

*extremely simplified version for inspiration*

Next is our main WHILE LOOP statement.

Have students run the game and bring up the variable watch window. If we use OR here, the fight can continue as long as either the player OR the ogre have health greater than 0. We can have that.

So we need to use AND meaning as soon as one of them reaches zero, the game is over.

13 of 17

Ogre’s and Oubliettes Fight sequence: Player vs Ogre

*extremely simplified version for inspiration*

The next step is to decide when the player or ogre will hit. This can be made much more complex. Here, I have simply show that we are generating 3 random numbers: 0, 1, and 2. If the random number is 2 in either case (make sure you are generative random number for each the ogre and player as show in the previous slide) then a hit is landed and we subtract 1 from the previously store score.

14 of 17

Ogres and Oubliettes Fight sequence: Player vs Ogre

*extremely simplified version for inspiration*

The last step is to check to see what condition triggered the exit.

Did the ogre reach 0? If so, they player won. If not, then the ogre won.

15 of 17

Ogre’s and Oubliettes Fight sequence: Player vs Ogre

*extremely simplified version for inspiration*

Press the green ‘play’ button to run code.

Use variable watch window to see point deductions and random numbers.

Here is the bulk of the code.

16 of 17

Assessment

– Can be as simple as “show me and explain by changing AND to OR”

Higher Level:

One assessment that I include is a table for the sample space of the roll of two dice.

I ask the students to shade the areas in Yellow where the roll of two dice are:

Dice1 > 3 AND Dice2 > 3

Then shade the numbers in blue where

Dice1 > 3 OR Dice2 > 3

Sample space looks like the table because

the roll of each dice(die) is 1,2,3,4,5,6

Green show the intersection of these events (stats)

which can be shown using a venn diagram as well.

1

2

3

4

5

6

1

1,1

1,2

1,3

1,4

1,5

1,6

2

2,1

2,2

2,3

2,4

2,5

2,6

3

3,1

2,2

3,3

3,4

3,5

3,6

4

4,1

4,2

4,3

4,4

4,5

4,6

5

5,1

5,2

5,3

5,4

5,5

5,6

6

6,1

6,2

6,3

6,4

6,5

6,6

17 of 17

Differentiation

Remediation

Extension/Enrichment

Students review algebra simple concepts and work together with a pair programmer who can help navigate the code with them.

Students track round count, track health, allow player or ogre to run away, call functions to increase health, etc…

There is at least ONE(1) BIG ISSUE with the fight as is:

Ogre gets health deducted first but right now, the ogre could be at 0 health and still hit the player. What AND condition will we need to add to correct this issue in the selection condition?

ANSWER: ogreRandomNums ==2 AND ogreHealth > 0