tictactoe
Class StreamPlayer

java.lang.Object
  |
  +--tictactoe.Asserter
        |
        +--tictactoe.InactivePlayer
              |
              +--tictactoe.StreamPlayer

public class StreamPlayer
extends InactivePlayer

Manage interaction with user. This implementation of Player gets its moved from a BufferedReader. This can either be a wrapper around the standard input stream, or a wrapper around a string representing a test case.

Version:
2.0 1999-03-26
Author:
Oscar.Nierstrasz@acm.org

Fields inherited from class tictactoe.InactivePlayer
_game
 
Constructor Summary
StreamPlayer(char mark)
          The normal contructor to use.
StreamPlayer(char mark, java.io.BufferedReader in)
          Constructor to specify an alternative source of moves (e.g., a test case StringReader).
StreamPlayer(char mark, java.lang.String moves)
          Special constructor to make a Player that plays a fixed set of moves from a String.
 
Method Summary
 void move()
          The Player makes a move by reading a line of text from the input stream, and interpreting it using chess notation, i.e., column is 'a' through 'c' and row is '1' through '3'.
 
Methods inherited from class tictactoe.InactivePlayer
isNobody, mark, setGame, toString
 
Methods inherited from class tictactoe.Asserter
assert
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StreamPlayer

public StreamPlayer(char mark,
                    java.io.BufferedReader in)
Constructor to specify an alternative source of moves (e.g., a test case StringReader).

StreamPlayer

public StreamPlayer(char mark)
The normal contructor to use. Just define the mark. The Player will get its input from the standard input stream.

StreamPlayer

public StreamPlayer(char mark,
                    java.lang.String moves)
Special constructor to make a Player that plays a fixed set of moves from a String. Used to define test cases.
Method Detail

move

public void move()
          throws java.io.IOException
The Player makes a move by reading a line of text from the input stream, and interpreting it using chess notation, i.e., column is 'a' through 'c' and row is '1' through '3'. The converted position is used to call BoardGame.move().
See Also:
GameDriver.playGame(tictactoe.BoardGame)