Miscellaneous changes. (#475)
* Miscellaneous changes. Replaced images with hand-drawn, added cover photos, corrected wording in rubric. * Small edits to 'Iteration' changes.
@ -1,5 +1,7 @@
|
|||||||
# Iteration & Looping
|
# Iteration & Looping
|
||||||
|
|
||||||
|
![Guitar Picture](/static/courses/csintro/iteration/guitar.jpg)
|
||||||
|
|
||||||
This lesson introduces the concept of looping and iteration. Presents the 'While' block as a combination of an iteration and a conditional statement.
|
This lesson introduces the concept of looping and iteration. Presents the 'While' block as a combination of an iteration and a conditional statement.
|
||||||
|
|
||||||
## Lesson objectives
|
## Lesson objectives
|
||||||
|
@ -79,7 +79,7 @@ A helpful feature of Microsoft MakeCode is "Slo-Mo", or slow-motion mode.
|
|||||||
* Click on the snail icon under the micro:bit simulator.
|
* Click on the snail icon under the micro:bit simulator.
|
||||||
This will slow down the execution (running) of the program, and highlight parts of your code so you can see step-by-step, which line of code is being processed.
|
This will slow down the execution (running) of the program, and highlight parts of your code so you can see step-by-step, which line of code is being processed.
|
||||||
|
|
||||||
![micro:bit sim in slo-mo](/static/courses/csintro/iteration/microbit-slo-mo.png)
|
![micro:bit sim in slo-mo](/static/courses/csintro/iteration/slo-mo.gif)
|
||||||
|
|
||||||
Now run your program several more times. Do you see the different lines of your code highlighted as the program runs? Do you see the sprite move?
|
Now run your program several more times. Do you see the different lines of your code highlighted as the program runs? Do you see the sprite move?
|
||||||
|
|
||||||
@ -189,6 +189,8 @@ We can use the default values for the rest of the parameters.
|
|||||||
|
|
||||||
You should now see a light moving from left to right along the top row of the micro:bit simulator.
|
You should now see a light moving from left to right along the top row of the micro:bit simulator.
|
||||||
|
|
||||||
|
![Moving Dot Top Row](/static/courses/csintro/iteration/moving-dot.gif)
|
||||||
|
|
||||||
To make our pattern continue through all the leds, we can change the value of the y coordinate as well.
|
To make our pattern continue through all the leds, we can change the value of the y coordinate as well.
|
||||||
|
|
||||||
To do this efficiently, using the fewest lines of code, we can even put a loop inside a loop. Loops inside other loops are known as **nested loops**.
|
To do this efficiently, using the fewest lines of code, we can even put a loop inside a loop. Loops inside other loops are known as **nested loops**.
|
||||||
@ -216,6 +218,8 @@ basic.forever(() => {
|
|||||||
|
|
||||||
There! With only a half dozen or so lines of code, we have made our light travel through all the coordinates on the micro:bit screen.
|
There! With only a half dozen or so lines of code, we have made our light travel through all the coordinates on the micro:bit screen.
|
||||||
|
|
||||||
|
![Moving Dot All](/static/courses/csintro/iteration/moving-dot-all.gif)
|
||||||
|
|
||||||
**Check:** Make sure the students can read this code.
|
**Check:** Make sure the students can read this code.
|
||||||
|
|
||||||
Here is what is happening to the values of the x & y coordinates as the program steps through each line and loop inside the forever block:
|
Here is what is happening to the values of the x & y coordinates as the program steps through each line and loop inside the forever block:
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# Project: Get loopy!
|
# Project: Get loopy!
|
||||||
|
|
||||||
|
![Birthday Card Project](/static/courses/csintro/iteration/birthday-card.jpg)
|
||||||
|
|
||||||
There are many different ways to use the three types of loop blocks.
|
There are many different ways to use the three types of loop blocks.
|
||||||
|
|
||||||
Recall the different common repetitive actions you thought of back at the beginning of this lesson.
|
Recall the different common repetitive actions you thought of back at the beginning of this lesson.
|
||||||
@ -26,7 +28,7 @@ https://youtu.be/Xvybu_T5IL8
|
|||||||
|
|
||||||
[**micro:bit Hat Man - inside view**](https://youtu.be/ZfKgFQjygQQ)
|
[**micro:bit Hat Man - inside view**](https://youtu.be/ZfKgFQjygQQ)
|
||||||
https://youtu.be/ZfKgFQjygQQ
|
https://youtu.be/ZfKgFQjygQQ
|
||||||
|
<br/>
|
||||||
This project uses the micro:bit light sensor to display a happy face when it is sunny, and a frowning face when it is dark. The micro:bit is connected to a servo mounted on the inside of the container, and the smile and frown are attached to plastic coffee stirrers with tape and hot glue.
|
This project uses the micro:bit light sensor to display a happy face when it is sunny, and a frowning face when it is dark. The micro:bit is connected to a servo mounted on the inside of the container, and the smile and frown are attached to plastic coffee stirrers with tape and hot glue.
|
||||||
|
|
||||||
## Reflection
|
## Reflection
|
||||||
@ -53,14 +55,14 @@ Have students write a reflection of about 150–300 words, addressing the follow
|
|||||||
|
|
||||||
**4 =** All variable names are unique and clearly describe what information values the variables hold<br/>
|
**4 =** All variable names are unique and clearly describe what information values the variables hold<br/>
|
||||||
**3 =** The majority of variable names are unique and clearly describe what information values the variables hold.<br/>
|
**3 =** The majority of variable names are unique and clearly describe what information values the variables hold.<br/>
|
||||||
**2 =** A minority of variable names are unique and clearly describe what information values the variables hold.<br/>
|
**2 =** Few variable names are unique or clearly describe what information values the variables hold.<br/>
|
||||||
**1 =** None of the variable names clearly describe what information values the variables hold.
|
**1 =** None of the variable names clearly describe what information values the variables hold.
|
||||||
|
|
||||||
### Sound, display, and motion
|
### Sound, display, and motion
|
||||||
|
|
||||||
**4 =** Uses sound, display, and motion in a way that is integral to the program.<br/>
|
**4 =** Uses sound, display, and motion in a way that is integral to the program.<br/>
|
||||||
**3 =** Uses a only two of the required element in a way that is integral to the program.<br/>
|
**3 =** Uses only two of the required elements in a way that is integral to the program.<br/>
|
||||||
**2 =** Uses a only one of the required element in a way that is integral to the program.<br/>
|
**2 =** Uses only one of the required elements in a way that is integral to the program.<br/>
|
||||||
**1 =** None of the required elements are used.
|
**1 =** None of the required elements are used.
|
||||||
|
|
||||||
### micro:bit program
|
### micro:bit program
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
# Unplugged: Walk a square
|
# Unplugged: Walk a square
|
||||||
|
|
||||||
|
![Chair with Pseudocode on the board.](/static/courses/csintro/iteration/chair-pseudo.png)
|
||||||
|
|
||||||
## Objective
|
## Objective
|
||||||
To reinforce the concept of iteration by having students act out the repeated steps of an algorithm in real life.
|
To reinforce the concept of iteration by having students act out the repeated steps of an algorithm in real life.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
Students will give the teacher instructions to do a simple activity, then look for places where using iteration could shorten their code and make it more efficient.
|
Students will give the teacher instructions to do a simple activity, then look for places where using iteration could shorten their code and make it more efficient.
|
||||||
|
|
||||||
![Chair](/static/courses/csintro/iteration/chair.jpg)
|
|
||||||
|
|
||||||
## Process
|
## Process
|
||||||
|
|
||||||
* Place a chair in the front of the room.
|
* Place a chair in the front of the room.
|
||||||
@ -41,7 +41,7 @@ This is a great opportunity to have the students think of the benefits of having
|
|||||||
## Notes
|
## Notes
|
||||||
* Depending on the particular class, you can make this exercise more challenging, by requiring the students to be more specific in their instructions.
|
* Depending on the particular class, you can make this exercise more challenging, by requiring the students to be more specific in their instructions.
|
||||||
|
|
||||||
For example: Step forward 14 inches (you can have students actually measure the exact distance), turn left 90 degrees...
|
**Example:** Step forward 14 inches (you can have students actually measure the exact distance), turn left 90 degrees...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BIN
docs/static/courses/csintro/iteration/birthday-card.jpg
vendored
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
docs/static/courses/csintro/iteration/chair-pseudo.png
vendored
Normal file
After Width: | Height: | Size: 181 KiB |
BIN
docs/static/courses/csintro/iteration/guitar.jpg
vendored
Normal file
After Width: | Height: | Size: 125 KiB |
BIN
docs/static/courses/csintro/iteration/moving-dot-all.gif
vendored
Normal file
After Width: | Height: | Size: 606 KiB |
BIN
docs/static/courses/csintro/iteration/moving-dot.gif
vendored
Normal file
After Width: | Height: | Size: 585 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 181 KiB |
BIN
docs/static/courses/csintro/iteration/shampoo.png
vendored
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 83 KiB |
BIN
docs/static/courses/csintro/iteration/slo-mo.gif
vendored
Normal file
After Width: | Height: | Size: 1.6 MiB |