Welcome to the forty-fourth of Altitude Foundation’s #MicroChallenges2020
Today’s challenge will help you 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 #44
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 yesterday’s challenge, you decomposed and listed 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.
It may be useful to do this or watch Altitude staff member Charlotte explain how to do so here.
The Challenge:
Today’s challenge is to create an algorithm to test different solutions for the river crossing problem.
Remember, you will need to consider:
- 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?
The second point will be particularly important for designing your algorithm – what logic underpins the problem i.e. what processes will you need to run to ensure that the programme determines the right outcome?
Review it:
- Algorithm design is a key part of the Computer Science GCSE – it might be useful to compare your algorithm to the layout suggested by, for example, the AQA exam board.
Advanced:
- Can you solve the problem? What is the minimum amount of crossings you have to make?
Share it
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 challenges@altitudefoundation.org. 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).