p2.tictactoe
Class InactivePlayer
java.lang.Object
p2.tictactoe.InactivePlayer
- All Implemented Interfaces:
- Player
- Direct Known Subclasses:
- GUIplayer, StreamPlayer
public class InactivePlayer
- extends java.lang.Object
- 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:
- $Id: InactivePlayer.java,v 1.1 2005/02/23 22:11:19 oscar Exp $
- Author:
- $Author: oscar $
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()
- Overrides:
toString
in class java.lang.Object
- Returns:
- the String representation of this Player
- See Also:
GameDriver.playGame(p2.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