agentland.games
Class InfocomAgent
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--metaglue.AgentAgent
|
+--agentland.util.GoodAgent
|
+--agentland.resource.ManagedAgent
|
+--agentland.games.InfocomAgent
- All Implemented Interfaces:
- Agent, Good, Infocom, Managed, MetagluePrimitives, Remote, Serializable, Spy, ZMachine.ZUserInterface
- public class InfocomAgent
- extends ManagedAgent
- implements Infocom, ZMachine.ZUserInterface
Agent to run Infocom (TM) text games like Zork, Lurking Horror, etc.
- See Also:
AgentAgent
,
Infocom
, Serialized Form
Methods inherited from class agentland.resource.ManagedAgent |
connect, getAlert, getNeed, isAvailable, isAvailable, reliesOn, reliesOn, replace, replace, request, request, request, requestAgent, requestAgent, resources, resourcesByAgentID, setNeed, tiedTo, yank, yank, yank |
Methods inherited from class agentland.util.GoodAgent |
addSpy, addSpy, alert, alertString, beep, error, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell |
Methods inherited from class metaglue.AgentAgent |
addMonitor, alive, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getProperties, getSociety, log, log, lookupClass, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, whereAreYou |
Methods inherited from interface agentland.util.Spy |
tell |
InfocomAgent
public InfocomAgent()
throws RemoteException
resetCPU
protected void resetCPU()
- Garbage collects the existing ZCPU object and creates a new one.
startGame
public void startGame(String filename)
throws RemoteException
- Specified by:
startGame
in interface Infocom
addInput
public void addInput(String s)
throws RemoteException
- Adds an input string to the input buffer.
- Specified by:
addInput
in interface Infocom
- Parameters:
s
- the input utterance.
fatal
public void fatal(String errmsg)
- Signals a fatal ZCPU error.
- Specified by:
fatal
in interface ZMachine.ZUserInterface
- Parameters:
errmsg
- The error message that causes the icky death.
quit
public void quit()
- Quit from running game.
- Specified by:
quit
in interface ZMachine.ZUserInterface
readChar
public int readChar(int time)
- Specified by:
readChar
in interface ZMachine.ZUserInterface
- Parameters:
time
- Reads in a character. If time is nonzero, times out.- Returns:
- The ASCII character code.
readLine
public int readLine(StringBuffer buf,
int time)
- Requests a line of input from the user. This is done through
voice now, so it looks in the input buffer.
- Specified by:
readLine
in interface ZMachine.ZUserInterface
- Parameters:
buf
- Appends the line to this buffer.time
- A time out. If time is nonzero, this method should time out after time tenths of a second.- Returns:
- The terminating character. If a timeout is received, this should return -1.
restart
public void restart()
- Prepare to restart the game. This currently does nothing.
- Specified by:
restart
in interface ZMachine.ZUserInterface
showString
public void showString(String str)
- Displays an output string using the text outputter.
- Specified by:
showString
in interface ZMachine.ZUserInterface
- Parameters:
str
- The string to output.
getFilename
public String getFilename(String title,
String suggested,
boolean save)
- Get a filename from the user for saving games, etc. Currently
this is just gamename.sav in the game directory.
- Specified by:
getFilename
in interface ZMachine.ZUserInterface
- Parameters:
title
- A title for a dialog boxsuggested
- a suggested file namesave
- whether the game is being saved (as opposed to loaded)- Returns:
- a
String
value
dictionaryContains
public boolean dictionaryContains(String testWord)
- Determine whether the current game's dictionary contains the
given word. Since Infocom games store only word prefixes, this
really just determines whether the word matches one of the items
in the dictionary.
- Specified by:
dictionaryContains
in interface Infocom
- Parameters:
testWord
- the word to lookup.- Returns:
- True if the word is present.
dictionaryFilter
public Filter dictionaryFilter()
- Specified by:
dictionaryFilter
in interface Infocom
defaultFontProportional
public boolean defaultFontProportional()
- Window-related methods -- not implemented.
- Specified by:
defaultFontProportional
in interface ZMachine.ZUserInterface
eraseLine
public void eraseLine(int param1)
- Specified by:
eraseLine
in interface ZMachine.ZUserInterface
eraseWindow
public void eraseWindow(int param1)
- Specified by:
eraseWindow
in interface ZMachine.ZUserInterface
getCursorLoc
public Point getCursorLoc()
- Specified by:
getCursorLoc
in interface ZMachine.ZUserInterface
getDefaultBackground
public int getDefaultBackground()
- Specified by:
getDefaultBackground
in interface ZMachine.ZUserInterface
getDefaultForeground
public int getDefaultForeground()
- Specified by:
getDefaultForeground
in interface ZMachine.ZUserInterface
getFontSize
public Dimension getFontSize()
- Specified by:
getFontSize
in interface ZMachine.ZUserInterface
getScreenCharacters
public Dimension getScreenCharacters()
- Specified by:
getScreenCharacters
in interface ZMachine.ZUserInterface
getScreenUnits
public Dimension getScreenUnits()
- Specified by:
getScreenUnits
in interface ZMachine.ZUserInterface
getWindowSize
public Dimension getWindowSize(int param1)
- Specified by:
getWindowSize
in interface ZMachine.ZUserInterface
hasBoldface
public boolean hasBoldface()
- Specified by:
hasBoldface
in interface ZMachine.ZUserInterface
hasColors
public boolean hasColors()
- Specified by:
hasColors
in interface ZMachine.ZUserInterface
hasFixedWidth
public boolean hasFixedWidth()
- Specified by:
hasFixedWidth
in interface ZMachine.ZUserInterface
hasItalic
public boolean hasItalic()
- Specified by:
hasItalic
in interface ZMachine.ZUserInterface
hasStatusLine
public boolean hasStatusLine()
- Specified by:
hasStatusLine
in interface ZMachine.ZUserInterface
hasUpperWindow
public boolean hasUpperWindow()
- Specified by:
hasUpperWindow
in interface ZMachine.ZUserInterface
initialize
public void initialize(int param1)
- Specified by:
initialize
in interface ZMachine.ZUserInterface
scrollWindow
public void scrollWindow(int param1)
- Specified by:
scrollWindow
in interface ZMachine.ZUserInterface
setColor
public void setColor(int param1,
int param2)
- Specified by:
setColor
in interface ZMachine.ZUserInterface
setCurrentWindow
public void setCurrentWindow(int param1)
- Specified by:
setCurrentWindow
in interface ZMachine.ZUserInterface
setCursorLoc
public void setCursorLoc(int param1,
int param2)
- Specified by:
setCursorLoc
in interface ZMachine.ZUserInterface
setFont
public void setFont(int param1)
- Specified by:
setFont
in interface ZMachine.ZUserInterface
setTerminatingCharacters
public void setTerminatingCharacters(Vector chars)
- Specified by:
setTerminatingCharacters
in interface ZMachine.ZUserInterface
setTextStyle
public void setTextStyle(int param1)
- Specified by:
setTextStyle
in interface ZMachine.ZUserInterface
showStatusBar
public void showStatusBar(String s,
int a,
int b,
boolean flag)
- Specified by:
showStatusBar
in interface ZMachine.ZUserInterface
splitScreen
public void splitScreen(int param1)
- Specified by:
splitScreen
in interface ZMachine.ZUserInterface