Welcome to the fourth of Altitude Foundation’s #MicroChallenges2020
In this challenge we generate random combinations of actions!
What’s a Micro Challenge?
These challenges are short activities to help you develop, revise or refresh your coding skills, posted every Monday, Wednesday and Friday (although we’re posting this challenge a day late in light of the bank holiday).
Micro Challenge #4
For the start of the week, we are going to create a random action generator as a way of exploring iterations and loops.
Create a random action generator:
- Make a list of different actions or outputs – you might choose different types of jumps, or using different colours, or drawing different shapes. Give each output a number.
- Using a randomiser (this could be using dice, or a number pulled out of a bag, or you can create a random number generator using the micro:bit’s MakeCode editor), create different sequences (generate a number to find out what your output is, and then generate another number to determine how many times to repeat the output).
- Write up the different sequences you come up with.
Here’s an example using a die:
List of movements:
1 = Forward one step
2 = Clap
3 = Side step left
4 = Side step right
5 = Click fingers on left hand
6 = Click fingers on right hand
My first two rolls get me 6, and 3, which could be written up as:
‘Click fingers on right hand, Click fingers on right hand, Click fingers on right hand.’
But could also be written as ‘Repeat 3 times: Click fingers on right hand’.
— What could you use this for? Could you get an exercise or dance routine out of it? Draw abstract art using it? Knit a scarf?
Once you’ve completed the challenge, review it:
— Here’s a video from BBC Bitesize about iterations: how might this link to what you’re doing?
— What is the advantage of using iterations? Think about the dance move example: why might you want to use iterations for a routine?
We would love to see what you have created! Please send any pictures, videos, or files of your activities to us – either via Facebook, Twitter or Instagram using #MicroChallenges2020 or to email@example.com. If you are emailing them to us, please let us know if you are happy for us to share your stuff on our social media platforms (with credit, of course).
Sign-up here to receive a weekly email with Micro Challenges top tips and solutions: