April 8, 2015 · Public
somebody can help me solve this problem?
Write a program that will provide a tour in the magic house. Throughout the tour do the following:
i.User can only enter the next place if it is linked to the current place (refer the diagram below - e.g. store is linked to front door and table is linked to store
ii.Whenever user enter a new place, the program will print the place where he is currently along with a short description of what the user can see there.
iii.At any point user can choose to go back out by going to the front door by entering 'back' at the next move prompt. To do so, the user must go through the correct path out that will bring him/her back to the front door (e.g. ifuser is in room1 then the path out is 1. Up stair, 2. Front door; if user is at window2, then the path out is either 1. Front door or 1. Bathroom2, 2. room2, 3. Up stair, 4. Front door. (Notice that from under bed, user can go to store and back to front door directly!)
iv.As long as the user enter the wrong path back user will keep finding his/her way until the correct path is found.
v.If user reach one of the 'dead end' place, (there are two in the diagram), program will declare that he/she is sucked forever in the house!
vi.Whenever the user enter 'exit' as the next move without providing the correct path back, he or she will be stuck forever in the house!
A sample output will be as follows