Micro Challenge #43 – Breaking down a problem

13 July 2020 - 2 minute read

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.

The Challenge:

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.

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?

You might want to break this down into variables (what can change) and constants (what remains the same). 

Review it:

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).

Leave a comment

Leave a Reply