EU Code Week 2020 - Day Three - Get Groovy
About this lesson
Let's see how we can apply the concept of commands we learned yesterday to something a little different today: dance!
For today's session you need to download the MeeBot 2.0 Dances playground. Don't worry if you don't have one of these cool robots, you can still write code that will have your virtual Meebot dancing.
When we find ourselves using a sequence of commands frequently, or in a unique pattern, we will often want to group these commands together in our own command, called a function.
For today's session you need to download the MeeBot 2.0 Dances playground. Don't worry if you don't have one of these cool robots, you can still write code that will have your virtual Meebot dancing.
When we find ourselves using a sequence of commands frequently, or in a unique pattern, we will often want to group these commands together in our own command, called a function.
Video
Recorded Tuesday, October 13th, 2020:
Recorded Tuesday, October 20th, 2020:
Unplugged Activity
Ode to Code dance loops algorithm
You will need:- No extra resources needed today.
- You can watch a video of the dance: Ode to code dance (YouTube)
Activity:
EU Codeweek has a special dance and music. It is called 'Ode to code'. We will teach you the moves to follow, which is a dance algorithm. We will be joined by our own MeeBot robot too!Extend
More Functions: We have one function named myDanceRoutine() in the Dance Routine page.
The nice thing about functions is that we can figure out a set of steps we want to take, write them all out, and then easily perform those steps by calling our function.
In the Basic Moves page, create a new function for a new dance move. It should look like this:
Hint: Be sure to call your function below where you've defined it.
Create a few functions of your favorite dance moves and swap them out as you show off your coolest dance steps.
More? If you want still more work with functions, open up the Learn to Code 2 playground.
Open up the Parameters chapter and watch the Introduction. We use functions to organize our code so that, once we've solved a problem, we can solve it more easily the next time by just using our function. With parameters we can make our functions even more powerful! Try out Moving Further Forward and Generalizing a Function to see if you can make your code even more impressive!
The nice thing about functions is that we can figure out a set of steps we want to take, write them all out, and then easily perform those steps by calling our function.
In the Basic Moves page, create a new function for a new dance move. It should look like this:
func myCoolDanceRoutine() {
moveToLeft()
moveForward()
}
Add in your own dance moves. Call this function in code.Hint: Be sure to call your function below where you've defined it.
Create a few functions of your favorite dance moves and swap them out as you show off your coolest dance steps.
More? If you want still more work with functions, open up the Learn to Code 2 playground.
Open up the Parameters chapter and watch the Introduction. We use functions to organize our code so that, once we've solved a problem, we can solve it more easily the next time by just using our function. With parameters we can make our functions even more powerful! Try out Moving Further Forward and Generalizing a Function to see if you can make your code even more impressive!