Conditionals updates (#474)
* Replaced images. Deleted old images. * Corrected filenames * Corrected filename. * Fixed traffic light filename. * Added battle pieces image. * Added paragraph break * Made sub-heading * Lower-case the image names.
@ -1,5 +1,7 @@
|
|||||||
# Conditional statements
|
# Conditional statements
|
||||||
|
|
||||||
|
![Rainbow Road](/static/courses/csintro/conditionals/cover.jpg)
|
||||||
|
|
||||||
This lesson introduces the Logic blocks such as 'If...then' and 'If...then...else'.
|
This lesson introduces the Logic blocks such as 'If...then' and 'If...then...else'.
|
||||||
Students practice skills of creativity, problem-solving, and collaboration.
|
Students practice skills of creativity, problem-solving, and collaboration.
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ Everyone will create the same program, the classic rock paper scissor game.
|
|||||||
![Rock, paper, scissors](/static/courses/csintro/conditionals/rock-paper-scissors.png)
|
![Rock, paper, scissors](/static/courses/csintro/conditionals/rock-paper-scissors.png)
|
||||||
|
|
||||||
## Introduce activity
|
## Introduce activity
|
||||||
|
|
||||||
* Have students recall the classic rock paper scissors game.
|
* Have students recall the classic rock paper scissors game.
|
||||||
* What are the rules of the game? What are the conditionals?
|
* What are the rules of the game? What are the conditionals?
|
||||||
>Example: If Player A gets rock, and Player B gets scissors, Then Player A wins.
|
>Example: If Player A gets rock, and Player B gets scissors, Then Player A wins.
|
||||||
@ -18,11 +19,13 @@ Else display scissors icon.
|
|||||||
* Point out that because there are only three possibilities, we don’t need to do a separate check to see if random number = 2. So we just use an else.
|
* Point out that because there are only three possibilities, we don’t need to do a separate check to see if random number = 2. So we just use an else.
|
||||||
|
|
||||||
## micro:bit
|
## micro:bit
|
||||||
|
|
||||||
* Working from the specifications, have students work in pairs to try to code a Rock Paper Scissors game on their own.
|
* Working from the specifications, have students work in pairs to try to code a Rock Paper Scissors game on their own.
|
||||||
* If students get stuck, there is a tutorial at [rock, paper, scissors](/projects/rock-paper-scissors) (steps 1 through 4), that leads students step-by-step through the process of coding a working rock paper scissor game for their micro:bit.
|
* If students get stuck, there is a tutorial at [rock, paper, scissors](/projects/rock-paper-scissors) (steps 1 through 4), that leads students step-by-step through the process of coding a working rock paper scissor game for their micro:bit.
|
||||||
* Let them play the game against their program.
|
* Let them play the game against their program.
|
||||||
|
|
||||||
## Ideas for Mods
|
## Ideas for Mods
|
||||||
|
|
||||||
* Add a way to keep score: Steps 5 through 7 in the tutorial
|
* Add a way to keep score: Steps 5 through 7 in the tutorial
|
||||||
* Mod the game to use different images or to add more options like ‘Rock Paper Scissors Lizard Spock’, Step 8 in the tutorial
|
* Mod the game to use different images or to add more options like ‘Rock Paper Scissors Lizard Spock’, Step 8 in the tutorial
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# Introduction
|
# Introduction
|
||||||
|
|
||||||
Computer programs are instructions telling the computer how to process input and deliver output.
|
Computer programs are instructions telling the computer how to process input and deliver output.
|
||||||
An important part of programming is telling the computer WHEN to perform a certain task.
|
An important part of programming is telling the computer WHEN to perform a certain task.
|
||||||
For this, we use something called ‘conditionals’. Conditionals get their name because a certain Condition or Rule has to be met.
|
For this, we use something called ‘conditionals’. Conditionals get their name because a certain Condition or Rule has to be met.
|
||||||
@ -23,7 +24,7 @@ Example:
|
|||||||
|
|
||||||
The ELSE portion makes sure that a different action is performed in either case. Without the ELSE action, your students might be barefoot!
|
The ELSE portion makes sure that a different action is performed in either case. Without the ELSE action, your students might be barefoot!
|
||||||
|
|
||||||
![If-Then workflow](/static/courses/csintro/conditionals/if-then-workflow.png)
|
![If-Then workflow](/static/courses/csintro/conditionals/flowchart.PNG)
|
||||||
|
|
||||||
Tell the students that they will be acting out some conditionals as though the whole class is a computer program for a game. Each student will perform a described action if the indicated condition is met.
|
Tell the students that they will be acting out some conditionals as though the whole class is a computer program for a game. Each student will perform a described action if the indicated condition is met.
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Project: Board Game
|
# Project: Board Game
|
||||||
|
|
||||||
|
![Close-up of game tokens](/static/courses/csintro/conditionals/game-pieces.jpg)
|
||||||
|
|
||||||
This is an assignment for students to create a board game. It should take two to three class periods. If your school has a makerspace or an art classroom where students can access materials such as cardboard, poster paints, or markers, you might schedule your classes to work there.
|
This is an assignment for students to create a board game. It should take two to three class periods. If your school has a makerspace or an art classroom where students can access materials such as cardboard, poster paints, or markers, you might schedule your classes to work there.
|
||||||
|
|
||||||
Once students have finished the first version of their games, schedule time for students to play each other’s games. Ideally, give them some time to give and gather feedback, then revise their games accordingly.
|
Once students have finished the first version of their games, schedule time for students to play each other’s games. Ideally, give them some time to give and gather feedback, then revise their games accordingly.
|
||||||
@ -36,7 +38,10 @@ The micro:bit might:
|
|||||||
Ideally, students should be writing their own versions of micro:bit programs to do something original.
|
Ideally, students should be writing their own versions of micro:bit programs to do something original.
|
||||||
Here is one simple program to discuss and use as an example:
|
Here is one simple program to discuss and use as an example:
|
||||||
|
|
||||||
Battle Game Pieces
|
![Close-up of game tokens](/static/courses/csintro/conditionals/battle-pieces.jpg)
|
||||||
|
|
||||||
|
### Battle pieces
|
||||||
|
|
||||||
In this example, pieces start out at full strength and lose points based on random events on the board. When two pieces meet on the same space, they battle.
|
In this example, pieces start out at full strength and lose points based on random events on the board. When two pieces meet on the same space, they battle.
|
||||||
* Press A to enter the strength of piece A.
|
* Press A to enter the strength of piece A.
|
||||||
* Then press B to enter the strength of piece B.
|
* Then press B to enter the strength of piece B.
|
||||||
@ -100,7 +105,7 @@ Space Race by K. and S.
|
|||||||
Finished game
|
Finished game
|
||||||
|
|
||||||
![micro:bit holder square](/static/courses/csintro/conditionals/microbit-holder.jpg)
|
![micro:bit holder square](/static/courses/csintro/conditionals/microbit-holder.jpg)
|
||||||
micro:bit Holder
|
micro:bit holder
|
||||||
|
|
||||||
![Game pieces](/static/courses/csintro/conditionals/game-pieces.jpg)
|
![Game pieces](/static/courses/csintro/conditionals/game-pieces.jpg)
|
||||||
Game pieces
|
Game pieces
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Unplugged: Red light, green light
|
# Unplugged: Red light, green light
|
||||||
|
|
||||||
![Red and green stoplight](/static/courses/csintro/conditionals/red-light-green-light.jpg)
|
![Red and green stoplight](/static/courses/csintro/conditionals/traffic-light.png)
|
||||||
|
|
||||||
## Objective
|
## Objective
|
||||||
To reinforce the programming of basic conditionals by having students experience conditionals through acting them out in real life.
|
To reinforce the programming of basic conditionals by having students experience conditionals through acting them out in real life.
|
||||||
|
BIN
docs/static/courses/csintro/conditionals/battle-pieces.jpg
vendored
Normal file
After Width: | Height: | Size: 156 KiB |
BIN
docs/static/courses/csintro/conditionals/cover.jpg
vendored
Normal file
After Width: | Height: | Size: 91 KiB |
BIN
docs/static/courses/csintro/conditionals/flowchart.PNG
vendored
Normal file
After Width: | Height: | Size: 182 KiB |
Before Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 12 KiB |
BIN
docs/static/courses/csintro/conditionals/rps.png
vendored
Normal file
After Width: | Height: | Size: 49 KiB |
BIN
docs/static/courses/csintro/conditionals/traffic-light.png
vendored
Normal file
After Width: | Height: | Size: 122 KiB |