diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..accb859 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +all: + javac *.java + +clean: + rm -rf *.class diff --git a/README b/README new file mode 100644 index 0000000..e901bed --- /dev/null +++ b/README @@ -0,0 +1,23 @@ +################### +# To compile code # +################### + +make all + +################### +# To cleanup code # +################### + +make clean + +################### +# To execute code # +################### + +java Zork [game xml] + +###################### +# Sample Walkthrough # +###################### +(Example inputs can be found in RunThroughResults.txt as to how to beat the sample game) +java Zork sampleGame.xml diff --git a/README.md b/README.md index fb4592b..2dca7c9 100644 --- a/README.md +++ b/README.md @@ -1,92 +1,4 @@ # Group7 - - -## Getting started - -To make it easy for you to get started with GitLab, here's a list of recommended next steps. - -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! - -## Add your files - -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: - -``` -cd existing_repo -git remote add origin https://gitlab.com/usi-si-teaching/msde/2022-2023/software-design-and-modeling/assignment-3-refactoring/group7.git -git branch -M main -git push -uf origin main -``` - -## Integrate with your tools - -- [ ] [Set up project integrations](https://gitlab.com/usi-si-teaching/msde/2022-2023/software-design-and-modeling/assignment-3-refactoring/group7/-/settings/integrations) - -## Collaborate with your team - -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. +Original and refactored sources for the https://github.com/dtschust/Zork Github +project. diff --git a/RunThroughResults.txt b/RunThroughResults.txt new file mode 100644 index 0000000..c6fbcc1 --- /dev/null +++ b/RunThroughResults.txt @@ -0,0 +1,84 @@ +Sample Run Through + +>IPA1 sample.xml +You find yourself at the mouth of a cave and decide that in spite of common sense and any sense of self preservation that you're going to go exploring north into it. It's a little dark, but luckily there are some torches on the wall. +>e +Can’t go that way. +>N +Error +>n +*stumble* need some light... +>i +Inventory: empty +>take torch +Item torch added to inventory. +>i +Inventory: torch +>n +A huge cavern surrounds you with a locked door to the north, a chest in the center, and a very dark corner... +>read torch +next to a small button it reads "push for big flame" +>turn on torch +You activate the torch. +the torch has erupted into a menacing inferno +You see a gnome in the dark corner... watching you with its super pointy hat... +>turn on torch +You activate the torch. +the torch has erupted into a menacing inferno +>n +lock needs a key... not to mention you don't want to get too close to that side of the room... there's something in that corner... +>attack gnome with torch +Error +>attack gnome with hand +Error +>attack gnome with face! +Error +>w +Can’t go that way. +>read chest +Error +>attack chest with torch +Error +>open chest +chest contains explosive. +>Excellent! +Error +>open chest +chest contains explosive. +>take explosive +Item explosive added to inventory. +>open chest +chest is empty. +>i +Inventory: torch, explosive +>attack gnome with explosive +Error +>read explosive +turn on for boom :-). Warning! Keep away from gnomes! +>turn on explosive +You activate the explosive. +you hear ticking... +>put explosive in chest +Item explosive added to chest. +>attack gnome with explosive +Error +>take dynamite +Error +>take explosive +Item explosive added to inventory. +>attack gnome with explosive +You assault the gnome with the explosive. +A tiny squeek is uttered from the tiny and, although scary looking, quite innocent creature before it vanishes in a very loud explosion. Tragic, but you find he was sitting on a key! +>take key +Item key added to inventory. +>drop key +key dropped. +>take key +Item key added to inventory. +>put key in lock +Item key added to lock. +The lock drops off and the door opens +>n +You found the exit! +>open exit +Game Over diff --git a/Zork.java b/Zork.java new file mode 100644 index 0000000..1bf2b48 --- /dev/null +++ b/Zork.java @@ -0,0 +1,1455 @@ +/*Drew Schuster + dtschust + ECE462 +*/ + +import java.io.File; +import javax.xml.parsers.*; +import org.w3c.dom.*; +import java.util.*; + + +/* Generic object, everything inherits from this*/ +class ZorkObject +{ + public String status; + public ArrayList trigger = new ArrayList(); + public ZorkObject() + { + } +} + +/* Generic condition*/ +abstract class ZorkCondition +{ + String object; + public abstract boolean evaluate(Zork zork); +} + +/* Status conditions*/ +class ZorkConditionStatus extends ZorkCondition +{ + String status; + public boolean evaluate(Zork zork) + { + ZorkObject tested = zork.Objects.get(object); + if (tested != null && tested.status.equals(status)) + return true; + else + return false; + } +} + +/* Has conditions*/ +class ZorkConditionHas extends ZorkCondition +{ + String has; + String owner; + public boolean evaluate(Zork zork) + { + /*Inventory is a special case as it isn't the name of any object in the game, check for it specifically*/ + if (owner.equals("inventory")) + { + if (zork.Inventory.get(object) != null && has.equals("yes") || zork.Inventory.get(object) == null && has.equals("no")) + { + return true; + } + else + { + return false; + } + } + else + { + /* is it a room?*/ + ZorkRoom roomObject = zork.Rooms.get(owner); + if ( roomObject != null ) + { + if ((roomObject).item.get(object) != null && has.equals("yes") || (roomObject).item.get(object) == null && has.equals("no")) + { + return true; + } + else + { + return false; + } + } + /* is it a container?*/ + else + { + ZorkContainer containerObject = zork.Containers.get(owner); + if (containerObject != null ) + { + if ((containerObject).item.get(object) != null && has.equals("yes") || (containerObject).item.get(object) == null && has.equals("no")) + { + return true; + } + else + { + return false; + } + + } + } + } + + return false; + } +} +/* Special Command condition*/ +class ZorkCommand extends ZorkCondition +{ + String command; + public boolean evaluate(Zork zork) + { + if (command.equals(zork.userInput)) + return true; + else + return false; + } +} + +/*Trigger*/ +class ZorkTrigger +{ + public ArrayList conditions = new ArrayList(); + String type="single"; /*By default, single*/ + boolean hasCommand = false; + public ArrayList print = new ArrayList(); + public ArrayList action = new ArrayList(); + + public boolean evaluate(Zork zork) + { + for(int i=0;i border = new HashMap(); + public HashMap container = new HashMap(); + public HashMap item = new HashMap(); + public HashMap creature = new HashMap(); + public ZorkRoom() + { + } +} + +/* Item*/ +class ZorkItem extends ZorkObject +{ + public String name; + public String description; + public String writing; + public ArrayList turnOnPrint = new ArrayList(); + public ArrayList turnOnAction = new ArrayList(); + public ZorkItem() + { + } +} + +/* Container*/ +class ZorkContainer extends ZorkObject +{ + public String name; + public HashMap item = new HashMap(); + public String description; + public ArrayList accept = new ArrayList(); + boolean isOpen; + public ZorkContainer() + { + } +} + +/* Creature*/ +class ZorkCreature extends ZorkObject +{ + public String name; + public String description; + public HashMap vulnerability = new HashMap(); + public ArrayList conditions = new ArrayList(); + public ArrayList print = new ArrayList(); + public ArrayList action = new ArrayList(); + public ZorkCreature() + { + } + /* Evaluate the success of an attack*/ + public boolean attack(Zork zork,String weapon) + { + if (vulnerability.get(weapon) == null) + { + return false; + } + for(int i=0;i Rooms = new HashMap(); + public HashMap Items = new HashMap(); + public HashMap Containers = new HashMap(); + public HashMap Objects = new HashMap(); + public HashMap Creatures = new HashMap(); + public HashMap Inventory = new HashMap(); + public HashMap ObjectLookup = new HashMap(); + public String currentRoom; + public File file; + public Zork(String filename) + { + int i,j,k,l,x,y,z; + + + + + + file = new File(filename); + if (!file.canRead()) + { + System.out.println("Error opening file. Exiting..."); + return; + } + + try + { + /* Open the xml file*/ + DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = builder.parse(file); + + Element rootElement = doc.getDocumentElement(); + + /* Every single first generation child is a room, container, creature, or item. So load them in*/ + NodeList nodes = rootElement.getChildNodes(); + for (k=0;k 0) + { + tempRoom.type = getString((Element)type.item(0)); + } + else + { + tempRoom.type = "regular"; + } + NodeList status = element.getElementsByTagName("status"); + if (status.getLength() > 0) + { + tempRoom.status = getString((Element)type.item(0)); + } + else + { + tempRoom.status = ""; + } + NodeList description = element.getElementsByTagName("description"); + tempRoom.description = getString((Element)description.item(0)); + + NodeList items = element.getElementsByTagName("item"); + for (j=0;j 0) + { + ZorkConditionHas tempConditionHas = new ZorkConditionHas(); + tempConditionHas.has = getString((Element)has.item(0)); + tempConditionHas.object = getString((Element)object.item(0)); + NodeList owner = condition.getElementsByTagName("owner"); + tempConditionHas.owner = getString((Element)owner.item(0)); + tempTrigger.conditions.add(tempConditionHas); + + } + else + { + ZorkConditionStatus tempConditionStatus = new ZorkConditionStatus(); + tempConditionStatus.object = getString((Element)object.item(0)); + NodeList sstatus = condition.getElementsByTagName("status"); + tempConditionStatus.status = getString((Element)sstatus.item(0)); + tempTrigger.conditions.add(tempConditionStatus); + } + + } + NodeList ttype = element.getElementsByTagName("type"); + if (ttype.getLength() > 0) + { + tempTrigger.type = getString((Element)ttype.item(0)); + } + else + { + tempTrigger.type = "single"; + } + NodeList prints = trigger.getElementsByTagName("print"); + for (l=0;l 0) + tempItem.name = getString((Element)name.item(0)); + + NodeList status = element.getElementsByTagName("status"); + if (status.getLength() > 0) + { + tempItem.status = getString((Element)status.item(0)); + } + else + { + tempItem.status = ""; + } + + NodeList description = element.getElementsByTagName("description"); + if (description.getLength()>0) + tempItem.description = getString((Element)description.item(0)); + + NodeList writing = element.getElementsByTagName("writing"); + if (writing.getLength()>0) + tempItem.writing = getString((Element)writing.item(0)); + + NodeList turnon = element.getElementsByTagName("turnon"); + if (turnon.getLength()>0) + { + NodeList prints = element.getElementsByTagName("print"); + for(j=0;j 0) + { + ZorkConditionHas tempConditionHas = new ZorkConditionHas(); + tempConditionHas.has = getString((Element)has.item(0)); + tempConditionHas.object = getString((Element)object.item(0)); + NodeList owner = condition.getElementsByTagName("owner"); + tempConditionHas.owner = getString((Element)owner.item(0)); + tempTrigger.conditions.add(tempConditionHas); + + } + else + { + ZorkConditionStatus tempConditionStatus = new ZorkConditionStatus(); + tempConditionStatus.object = getString((Element)object.item(0)); + NodeList sstatus = condition.getElementsByTagName("status"); + tempConditionStatus.status = getString((Element)sstatus.item(0)); + tempTrigger.conditions.add(tempConditionStatus); + } + + } + NodeList ttype = element.getElementsByTagName("type"); + if (ttype.getLength() > 0) + { + tempTrigger.type = getString((Element)ttype.item(0)); + } + else + { + tempTrigger.type = "single"; + } + NodeList prints = trigger.getElementsByTagName("print"); + for (l=0;l0) + tempCont.name = getString((Element)name.item(0)); + + NodeList status = element.getElementsByTagName("status"); + if (status.getLength()>0) + tempCont.status = getString((Element)status.item(0)); + + /*Initially assume a closed container*/ + tempCont.isOpen = false; + NodeList description = element.getElementsByTagName("description"); + if (description.getLength()>0) + tempCont.description = getString((Element)description.item(0)); + + NodeList accepts = element.getElementsByTagName("accept"); + for(j=0;j 0) + { + ZorkConditionHas tempConditionHas = new ZorkConditionHas(); + tempConditionHas.has = getString((Element)has.item(0)); + tempConditionHas.object = getString((Element)object.item(0)); + NodeList owner = condition.getElementsByTagName("owner"); + tempConditionHas.owner = getString((Element)owner.item(0)); + tempTrigger.conditions.add(tempConditionHas); + + } + else + { + ZorkConditionStatus tempConditionStatus = new ZorkConditionStatus(); + tempConditionStatus.object = getString((Element)object.item(0)); + NodeList sstatus = condition.getElementsByTagName("status"); + tempConditionStatus.status = getString((Element)sstatus.item(0)); + tempTrigger.conditions.add(tempConditionStatus); + } + + } + NodeList ttype = element.getElementsByTagName("type"); + if (ttype.getLength() > 0) + { + tempTrigger.type = getString((Element)ttype.item(0)); + } + else + { + tempTrigger.type = "single"; + } + NodeList prints = trigger.getElementsByTagName("print"); + for (l=0;l0) + tempCreature.name = getString((Element)name.item(0)); + + NodeList status = element.getElementsByTagName("status"); + if (status.getLength()>0) + tempCreature.status = getString((Element)status.item(0)); + + NodeList description = element.getElementsByTagName("description"); + if (description.getLength()>0) + tempCreature.description = getString((Element)description.item(0)); + + NodeList vulns = element.getElementsByTagName("vulnerability"); + for(j=0;j 0) + { + ZorkConditionHas tempConditionHas = new ZorkConditionHas(); + tempConditionHas.has = getString((Element)has.item(0)); + tempConditionHas.object = getString((Element)object.item(0)); + NodeList owner = condition.getElementsByTagName("owner"); + tempConditionHas.owner = getString((Element)owner.item(0)); + tempCreature.conditions.add(tempConditionHas); + + } + else + { + ZorkConditionStatus tempConditionStatus = new ZorkConditionStatus(); + tempConditionStatus.object = getString((Element)object.item(0)); + NodeList sstatus = condition.getElementsByTagName("status"); + tempConditionStatus.status = getString((Element)sstatus.item(0)); + tempCreature.conditions.add(tempConditionStatus); + } + + } + NodeList prints = attack.getElementsByTagName("print"); + for (l=0;l 0) + { + ZorkConditionHas tempConditionHas = new ZorkConditionHas(); + tempConditionHas.has = getString((Element)has.item(0)); + tempConditionHas.object = getString((Element)object.item(0)); + NodeList owner = condition.getElementsByTagName("owner"); + tempConditionHas.owner = getString((Element)owner.item(0)); + tempTrigger.conditions.add(tempConditionHas); + + } + else + { + ZorkConditionStatus tempConditionStatus = new ZorkConditionStatus(); + tempConditionStatus.object = getString((Element)object.item(0)); + NodeList sstatus = condition.getElementsByTagName("status"); + tempConditionStatus.status = getString((Element)sstatus.item(0)); + tempTrigger.conditions.add(tempConditionStatus); + } + + } + NodeList ttype = element.getElementsByTagName("type"); + if (ttype.getLength() > 0) + { + tempTrigger.type = getString((Element)ttype.item(0)); + } + else + { + tempTrigger.type = "single"; + } + NodeList prints = trigger.getElementsByTagName("print"); + for (l=0;l element that is not one of the "Special Commands"*/ + public void action(String input) + { + int i,j,k,l,x,y,z; + String tempString; + ZorkContainer tempContainer; + + /* Movement */ + if (input.equals("n") || input.equals("s") || input.equals("e") || input.equals("w")) + { + move(input); + } + /* Inventory */ + else if (input.equals("i")) + { + inventory(); + } + /* Take */ + else if (input.startsWith("take") && input.split(" ").length>=1) + { + tempString = input.split(" ")[1]; + if ((Rooms.get(currentRoom)).item.get(tempString) != null) + { + Inventory.put(tempString,tempString); + ZorkRoom tempRoom = (Rooms.get(currentRoom)); + tempRoom.item.remove(tempString); + Rooms.put(tempRoom.name,tempRoom); + System.out.println("Item "+tempString+" added to inventory."); + } + else + { + /*Search all containers in the current room for the item!*/ + boolean found=false; + for (String key : Rooms.get(currentRoom).container.keySet()) + { + tempContainer = Containers.get(key); + if (tempContainer != null && tempContainer.isOpen && tempContainer.item.get(tempString) != null) + { + Inventory.put(tempString,tempString); + tempContainer.item.remove(tempString); + Containers.put(tempContainer.name,tempContainer); + System.out.println("Item "+tempString+" added to inventory."); + found=true; + break; + } + } + if (!found) + System.out.println("Error"); + } + } + /* Open Exit (you should be so lucky)*/ + else if (input.equals("open exit")) + { + if (Rooms.get(currentRoom).type.equals("exit")) + { + System.out.println("Game Over"); + System.exit(0); + } + else + { + System.out.println("Error"); + } + } + /* Open a container */ + else if (input.startsWith("open") && input.split(" ").length>=1) + { + tempString = input.split(" ")[1]; + String found = Rooms.get(currentRoom).container.get(tempString); + if (found != null) + { + tempContainer = Containers.get(tempString); + tempContainer.isOpen = true; + containerInventory(tempContainer.item,tempString); + } + else + { + System.out.println("Error"); + } + } + /* Read an object */ + else if (input.startsWith("read") && input.split(" ").length>=1) + { + tempString = input.split(" ")[1]; + ZorkItem tempItem; + if (Inventory.get(tempString) != null) + { + tempItem = Items.get(tempString); + if (tempItem.writing != null && tempItem.writing != "") + { + System.out.println(tempItem.writing); + } + else + { + System.out.println("Nothing written."); + } + } + else + { + System.out.println("Error"); + } + } + /* Drop an item*/ + else if (input.startsWith("drop") && input.split(" ").length>=1) + { + tempString = input.split(" ")[1]; + if (Inventory.get(tempString) != null) + { + ZorkRoom tempRoom = Rooms.get(currentRoom); + tempRoom.item.put(tempString,tempString); + Rooms.put(tempRoom.name,tempRoom); + Inventory.remove(tempString); + System.out.println(tempString+" dropped."); + } + else + { + System.out.println("Error"); + } + } + /* Put an item somewhere */ + else if (input.startsWith("put") && input.split(" ").length>=4) + { + tempString = input.split(" ")[1]; + String destination = input.split(" ")[3]; + if (Rooms.get(currentRoom).container.get(destination) != null && Containers.get(destination).isOpen && Inventory.get(tempString) != null) + { + tempContainer = Containers.get(destination); + tempContainer.item.put(tempString,tempString); + Inventory.remove(tempString); + System.out.println("Item "+tempString+" added to "+destination+"."); + } + else + { + System.out.println("Error"); + } + } + /* Turn on an item*/ + else if (input.startsWith("turn on") && input.split(" ").length>=3) + { + tempString = input.split(" ")[2]; + ZorkItem tempItem; + if (Inventory.get(tempString) != null) + { + tempItem = Items.get(tempString); + System.out.println("You activate the "+tempString+"."); + if (tempItem != null) + { + for (y=0;y=4) + { + tempString = input.split(" ")[1]; + ZorkCreature tempCreature; + String weapon = input.split(" ")[3]; + if (Rooms.get(currentRoom).creature.get(tempString) != null) + { + tempCreature = Creatures.get(tempString); + if (tempCreature != null && Inventory.get(weapon)!= null) + { + if (tempCreature.attack(this,weapon)) + { + System.out.println("You assault the "+tempString+" with the "+weapon+"."); + for (y=0;y Container, String Name) + { + String output = ""; + if (Container.isEmpty()) + { + System.out.println(Name+" is empty"); + } + else + { + System.out.print(Name+" contains "); + for (String key : Container.keySet()) + { + output += key+", "; + } + output = output.substring(0,output.length()-2); + System.out.println(output+"."); + } + } + + /* Print out the inventory when user types i */ + public void inventory() + { + String output = "Inventory: "; + if (Inventory.isEmpty()) + { + System.out.println("Inventory: empty"); + } + else + { + for (String key : Inventory.keySet()) + { + output += key+", "; + } + output = output.substring(0,output.length()-2); + System.out.println(output); + } + } + + + /* I love how basic java main functions are sometimes.*/ + public static void main(String[] args) + { + if (args.length != 1) + { + System.out.println("Usage: java Zork [filename]"); + return; + } + new Zork(args[0]); + } +} diff --git a/sampleGame.xml b/sampleGame.xml new file mode 100644 index 0000000..2c4c95c --- /dev/null +++ b/sampleGame.xml @@ -0,0 +1,116 @@ + + + + Entrance + You find yourself at the mouth of a cave and decide that in spite of common sense and any sense of self preservation that you're going to go exploring north into it. It's a little dark, but luckily there are some torches on the wall. + torch + + permanent + n + + no + torch + inventory + + *stumble* need some light... + + + north + MainCavern + + + + MainCavern + A huge cavern surrounds you with a locked door to the north, a chest in the center, and a very dark corner... + chest + lock + gnome + + south + Entrance + + + north + Staircase + + + n + permanent + + lock + locked + + lock needs a key... not to mention you don't want to get too close to that side of the room... there's something in that corner... + + + + exit + Staircase + You found the exit! + + MainCavern + south + + + + torch + next to a small button it reads "push for big flame" + lit + + the torch has erupted into a menacing inferno + Update torch to inferno + + + + explosive + turn on for boom :-). Warning! Keep away from gnomes! + idle + + you hear ticking... + Update explosive to ticking + + + + key + Exit + + + chest + explosive + + + lock + locked + key + + + yes + key + lock + + The lock drops off and the door opens + Update lock to unlocked + + + + gnome + explosive + + + explosive + ticking + + A tiny squeek is uttered from the tiny and, although scary looking, quite innocent creature before it vanishes in a very loud explosion. Tragic, but you find he was sitting on a key! + Add key to MainCavern + Delete gnome + + + single + + torch + inferno + + You see a gnome in the dark corner... watching you with its super pointy hat... + + + diff --git a/zorkRequirements.pdf b/zorkRequirements.pdf new file mode 100644 index 0000000..b02bd76 Binary files /dev/null and b/zorkRequirements.pdf differ