package project; import java.io.BufferedReader; import java.io.InputStreamReader; import rebelsky.io.Pen; import java.util.Comparator; /** * A really simple World for testing the MUG. * * * @author CS152 2004F * @version 1.0 of November 2004 */ public class StubWorld implements WorldInterface { // +----------------+------------------------------------------ // | Public Methods | // +----------------+ /** * Find all the people in a room */ public String[] listPeople(String room) { return new String[] { "angeline", "eryn", "samr" }; } // listPeople(String) /** * Record that an interaction has happened. Return a comment on the * results of the action. * * @exception * If the action is invalid or the object is invalid or ... */ public String perform(Action tim) throws InvalidVerbException, InvalidTargetException { double d = Math.random(); if (d < 0.5) return "Done."; else if (d < 0.75) throw new InvalidVerbException(); else throw new InvalidTargetException(); } // perform(Action) /** * Get the location of this person */ public String getLocation(String username) { return "Haines"; } // getLocation(String) /** * List the contents of the room */ public String[] listContents(String room) { return new String[] {"computers", "beer", "beds", "pizza"}; } // listContents(String) /** * Describe this thing */ public String describe(String thing) { return "Damn ugly!"; } } // class StubWorld