翁恺老师 Java进阶教程 城堡游戏 修改后
标题#game
import java.util.HashMap;
import java.util.Scanner;
public class Game {
private Room currentRoom;
private HashMap<String, Handler> handlers = new HashMap<String, Handler>();
public void printWelcome() {
System.out.println(" ");
System.out.println("欢迎!");
System.out.println(" ");
System.out.println("这是一个超级无聊的城堡游戏");
System.out.println(" ");
System.out.println("如果你需要帮助请输入:help");
System.out.println(" ");
System.out.println("那么现在开始吧!");
System.out.println(" ");
System.out.println("你现在在"+currentRoom+" "+currentRoom.getExitsdes());
System.out.println();
}
public void createRoom() {
Room castle,read,outside,bar,bedroom;
//创建房间
castle = new Room("大堂");
read = new Room(