08-02-2003, 10:58 PM

This was originally a 10th grade maths extra credit problem. I made a computer program to solve it and display the kangaroo steps recently.

Can you solve it and/or make a program that shows each step?

Here it is, the Kangaroo Problem (I rewrote it from memory)

Can you solve it and/or make a program that shows each step?

Here it is, the Kangaroo Problem (I rewrote it from memory)

Code:

`'The point of this program is to solve`

'the Kangaroo Problem, defined as follows:

'There are N kangaroos crossing a bridge from both sides.

'(so 2N kangaroos total)

'

'They need to get to their respective other sides.

'The only problem is that the bridge is so narrow

'that they can only move forward and not sideways.

'

'At first the kangaroos line up like this: >>>_<<< (n = 3)

'They need to line up like this: <<<_>>>

'

'Kangaroos can HOP and JUMP.

'A kangaroo HOP moves the Kangaroo forward one space: >_ to _>

'A kangaroo JUMP moves the Kangaroo forward two spaces: ><_ to >_>

'

'How to HOP and JUMP the kangaroos to the other side?

'(two kangaroos can't occupy one space!)

'HINT Try to solve the problems with small N's first!