This commit is contained in:
jslightham
2019-04-26 15:35:03 -04:00
parent 14bd1aa83f
commit 3358439e02
10 changed files with 140 additions and 21 deletions

View File

@@ -5,6 +5,8 @@ import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Scanner;
import com.bayviewglen.zork.Items.*;
/**
* Class Game - the main class of the "Zork" game.
*
@@ -32,8 +34,10 @@ class Game {
// masterRoomMap.get("GREAT_ROOM") will return the Room Object that is the
// Great Room (assuming you have one).
private HashMap<String, Room> masterRoomMap;
private HashMap<Item, String> itemsInRooms = new HashMap<Item, String>();
private void initRooms(String fileName) throws Exception {
itemsInRooms.put(new Candlestick(), "Candlestick");
masterRoomMap = new HashMap<String, Room>();
Scanner roomScanner;
try {
@@ -154,6 +158,12 @@ class Game {
case "eat":
System.out.println("Do you really think you should be eating at a time like this?");
break;
case "look":
for (Item i : itemsInRooms.keySet()) {
System.out.print(i.getName() + " ");
}
System.out.println();
break;
default:
return false;
}
@@ -194,4 +204,4 @@ class Game {
}
}
}
}