programming with angry birds lesson 1

Programming with Angry Birds: Lesson 1

By Anthony Harris
AD

Imagine this: you're trying to teach programming to a classroom full of kids, but you want to make it engaging and fun. Suddenly, an idea hits you - why not use everyone's favorite slingshot birds? Welcome to Programming with Angry Birds, where we make learning code as exciting as flinging birds to destroy pig forts. Let's dive into Lesson 1.

This may seem like an unusual combo - Angry Birds and programming - but bear with me. By integrating the popular game with coding concepts, we're transforming a potentially dull subject into an interactive, exciting learning experience. So, grab your pig-popping enthusiasm and let's code!

Understanding the Basics

The first step in our programming journey involves understanding the basics of coding. Just like knowing how to aim and launch birds in Angry Birds, understanding the fundamental principles of programming is crucial.

AD
What Angry Birds Can Teach Us About Analytics
What Angry Birds Can Teach Us About Analytics
an angry bird with the words how to teach physics with angry birds
an angry bird with the words how to teach physics with angry birds
Teaching With Angry Birds
Teaching With Angry Birds

In coding, everything revolves around algorithms. Much like the strategies you employ to topple the pigs' structures, algorithms are instructions given to a computer to solve a problem. They involve a series of steps that must be followed in the correct order to achieve a desired result.

Sequence: Building Your Code Castle

Sequence is the first step in every algorithm. Just as you start your Angry Birds game by selecting a bird and aiming, your code begins with a sequence of initial statements. This sets up the environment for your program, like choosing the level, selecting the bird, and setting the slingshot's power.

Yellow Angry Birds dot to dot printable worksheet
Yellow Angry Birds dot to dot printable worksheet
Games in Math Education
Games in Math Education
Learn to Create Angry Birds in Adobe After Effects!
Learn to Create Angry Birds in Adobe After Effects!

For example, in Python, your sequence might look like this:

```python print("Welcome to Angry Birds Programming!") bird = "Red" power = 50 ```

Repetition: Saving Your Bird Ammo

In Angry Birds, sometimes you need to use your birds wisely to clear the entire level. This is where repetition, or loops, comes in. Loops allow you to repeat a set of instructions multiple times, much like launching your birds until all the pigs are gone.

AD

In Python, a for loop is often used for repetition. Here's how you might use it to represent launching each bird in your inventory:

the angry birds are all drawn in different colors
the angry birds are all drawn in different colors
Angry Birds Activities in the Classroom
Angry Birds Activities in the Classroom
a white board with writing on it that says angry bird misson, build draw b test write what happened? was your building strong enough? how can you make it better?
a white board with writing on it that says angry bird misson, build draw b test write what happened? was your building strong enough? how can you make it better?
Matilda Old Loon in Angry Birds dot to dot printable worksheet
Matilda Old Loon in Angry Birds dot to dot printable worksheet
Angry Birds = Happy Students
Angry Birds = Happy Students
an angry birds game is shown with many different kinds of birds in front of them
an angry birds game is shown with many different kinds of birds in front of them
```python birds = ["Red", "Yellow", "Blue", "Black"] for bird in birds: print("Launching", bird) ```

Branching: Strategy Changes Mid-game

Midway through a level, you might realize that your strategy isn't working. You need to change your approach - this is where branching comes in. Branching, or conditional statements, allows your program to make decisions based on certain conditions, just like switching your strategy mid-game.

In Python, an if statement is used for branching. Here's how you might use it to check if a certain bird is in your inventory:

AD
```python if "Black" in birds: print("We have a Black bird!") else: print("We don't have a Black bird.") ```

Branching with Else: When Pigs Escape

In Angry Birds, there are times when some pigs survive your attack and escape. Similarly, in programming, there are situations where the initial 'if' condition isn't met. In such cases, we use an else statement to handle these situations.

an image of the angry birds game
an image of the angry birds game
ANGRY BIRDS GAMES
ANGRY BIRDS GAMES
Woah- not a single explanation or anything
Woah- not a single explanation or anything

Here's how you might use it to launch a 'Yellow' bird only if it's available:

```python if "Yellow" in birds: print("Launching Yellow bird") else: print("We don't have a Yellow bird, using another bird.") ```

In conclusion, just like Angry Birds has rules to follow and strategies to employ, programming has principles to understand and apply. By combining these two, we're transforming the complex world of coding into an engaging, enjoyably exploratory experience. So, grab your projectiles and let's continue this programming adventure in the next lesson!

AD
AD