
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The steps to implement exits between rooms and functional command interpreters in a room environment. The process involves modifying the xml file to include exits, parsing the file in a two-pass manner, creating a constructor for room that takes a list of exits, and adding a method to generate pointers to destination rooms. Once all rooms are built, generateexits should be called for each room. After exits are working, modify the command interpreter to accept exit commands and create a hierarchy for command interpretation.
Typology: Lab Reports
1 / 1
This page cannot be seen from the preview
Don't miss anything!
Lab # Summary Our goal this week is to get Exits working throughout our application, and have our Command Interpreters functioning throughout the application as discussed in class. The first step would be to modify our XML file to include exits between rooms. As discussed in class, these exits can either be relative or absolute paths to other rooms in the environment. The parsing of this file will be done in a “two-pass” manner. This does not necessarily mean that you will parse the XML file twice, but rather that you need to temporarily do something with the exits while you are parsing the XML file. Then once all the rooms are built, you can go back through and add exits to them. A good solution to this might be to change the constructor for Room to take a list of exits in their relative or absolute path form. Then add a method to Room called generateExits which actually creates the pointers to the destination Rooms. Once you have finished building all the Rooms in the Environment, go back and call generateExits for each Room. At this point in time, all the possible destination Rooms should be created and creating a pointer to them should be possible. Once this is working, modify your command interpreter to accept exit commands. Maybe north,south,east,west or something similar to this. Once you can successfully exit a Room and arrive at a new Room, then modify your command interpreter structure as we discussed in class. Every Environment, Area, and Room can have a command interpreter associated with it. When one issues a command, it should try to get interpreted by the Room they are in first. If it can’t be interpreted there, it should work its way up the hierarchy until it is either interpreted or gets to the top and can then be deemed an invalid command.