Welcome to the forty-third of Altitude Foundation’s #MicroChallenges2020
Today’s challenge will help you break down a problem to be able to programme a solution
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 #43
This week, we are exploring decomposition and algorithm design. You can read up on these topics in challenge 1, challenge 11, and challenge 39.
In today’s challenge, we would like you to breakdown and list the parameters of the classic river crossing problem:
A farmer needs to transport a goat, a fox and a bunch of carrots across a river in a boat that can only hold the farmer and one other object or animal.
If left unattended together, the fox would eat the goat, or the goat would eat the carrots.
- What conditions do you need to take into account to solve the problem?
- How can you describe the conditions? (i.e. what logic underpins the problem)?
- What choices does the user need to be allowed to make?
You might want to break this down into variables (what can change) and constants (what remains the same).
- This kind of decomposition is a key part of the Computer Science GCSE – it might be useful to compare your decomposition to the layout suggested by, for example, the AQA exam board.
- Can you solve the problem? What is the minimum amount of crossings you have to make?
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).