tictactoe
Class InactivePlayer
java.lang.Object
|
+--tictactoe.Asserter
|
+--tictactoe.InactivePlayer
- Direct Known Subclasses:
- AppletPlayer, StreamPlayer
- public class InactivePlayer
- extends Asserter
- implements Player
Manage interaction with user.
This class implements "nobody" -- a Player that has an identity,
but does not make moves. Serves as a superclass for other implementations.
- Version:
- 2.0 1999-03-26
- Author:
- Oscar.Nierstrasz@acm.org
Constructor Summary |
InactivePlayer()
Special constructor for the Player representing nobody. |
InactivePlayer(char mark)
The normal contructor to use. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
_game
protected BoardGame _game
InactivePlayer
public InactivePlayer(char mark)
- The normal contructor to use.
- Parameters:
mark
- the character representing this player ('X' or 'O')
InactivePlayer
public InactivePlayer()
- Special constructor for the Player representing nobody.
(Used by TicTacToe as a placeholder when there is no
winner yet.)
- See Also:
AbstractBoardGame
mark
public char mark()
- Specified by:
- mark in interface Player
- Returns:
- the char representation of this Player
- See Also:
AbstractBoardGame.toString()
toString
public java.lang.String toString()
- Returns:
- the String representation of this Player
- Overrides:
- toString in class java.lang.Object
- See Also:
GameDriver.playGame(tictactoe.BoardGame)
isNobody
public boolean isNobody()
- Specified by:
- isNobody in interface Player
- Returns:
- whether this Player represents "nobody".
(By convention, a Player with a blank as its mark.)
setGame
public void setGame(BoardGame game)
- Let this player join a particular game.
Set by a BoardGame when it is instantiated with Players.
- Specified by:
- setGame in interface Player