Welcome to the thirty-sixth of Altitude Foundation’s #MicroChallenges2020
Today’s challenge will show you how to use binary to create images
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.
Micro Challenge #36
Binary can work as a form of Boolean operator, where 1 = true and 0 = false. You can use these digits as a way of conveying information – for example creating images in a grid!
Binary can also work as an information system – so instead of 0s and 1s corresponding to numbers, we can set them to correspond to other information. For example, here are some colours in binary:
- 00 – white
- 01 – blue
- 10 – green
- 11 – red
Using two binary digits per square means that that square can hold 2 bits of information. If we were to add another digit, the square would hold 3 bits of information – and you can store up to eight colours! Every time you add a bit or digit, you double the amount of information you can store.
Today’s challenge is to create three images – one using binary as a Boolean operator; one using the 2-bit colour scheme; and one using 3 or more bits. For the third challenge, you will need to assign values to your binary digits, essentially storing data on them!
- Can you colour in your patterns to create the intended image?
- Could you use pseudocode to describe your colour assignments for the third challenge?
Win a micro:bit!
- The giveaway is open to any young person aged between 14 and 18 based in the UK.
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: