1. New Comer (less than 5 posts)
Join Date
Nov 2009
Posts
2
Thanks
0
Thanked 0 Times in 0 Posts

## Labyrinth

Let's say we let a hamster run in a 3-dimensional labyrinth.

The labyrinth has a certain number of chambers and a certain number of tunnels connecting the chambers. Each tunnel connects two chambers.

We let the hamster in from one end of the labyrinth and it must come out from the other one.

All the tunnels are one-way. Also, the chambers and tunnels are positioned, so that the hamster can never go back to a chamber it has already been to.

The program itself has to count how many possibilities the hamster has to get from the releasing chamber to the chamber with the exit from the labyrinth.

We know the number of the chambers and we know the number of the tunnels. Every chamber has a number, so the hamster starts from chamber number 1 and ends in the last (the highest) numbered chamber.

We also know the number data of the tunnels (from which chamber can the hamster move to which chamber).

For example:
Chambers: 5
Tunnels: 6

Tunnels (A to B):
1 -> 2
1 -> 3
3 -> 4
4 -> 5
2 -> 3
3 -> 5
What kind of guidelines should I follow while solving the problem?

2. This may be someone's homework assignment, but I wouldn't mind a hint too. I have tried for loops, 2d arrays, while loops, a function that looks for all possible combinations, but none do exactly like he is asking for.

It is really easy to figure out on paper, but for some reason this simple problem is stumping me when I try to write the code for it.

3. New Comer (less than 5 posts)
Join Date
Nov 2009
Posts
2
Thanks
0
Thanked 0 Times in 0 Posts
Well, I found out the solution. It does in fact lay in 2-dimensional arrays.

The topic may be locked now

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•