edu.lhup.ai
Class ConsolePlayer

java.lang.Object
  |
  +--edu.lhup.ai.ConsolePlayer
All Implemented Interfaces:
IPlayer

public class ConsolePlayer
extends Object
implements IPlayer

This can be considered a "human" player because it accepts moves from the command line.

This software is for educational purposes only.

Author:
Mark Cohen

Constructor Summary
ConsolePlayer()
           
 
Method Summary
 String getDescription()
           
 String getShortDescription()
           
 void setCutoff(int cutoff)
          Provides a mechanism for specifying the point at which a player's abandons the search for the best move.
 void setEvaluator(IEvaluator evaluator)
          Provides a mechanism for specifying a player's evaluation strategy.
 void takeTurn(IBoard board)
          Prompts the user for the next move via the command line.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConsolePlayer

public ConsolePlayer()
Method Detail

getDescription

public String getDescription()
Specified by:
getDescription in interface IPlayer
Returns:
a description of this player.

getShortDescription

public String getShortDescription()
Specified by:
getShortDescription in interface IPlayer
Returns:
a short description of this player.

setEvaluator

public void setEvaluator(IEvaluator evaluator)
Description copied from interface: IPlayer
Provides a mechanism for specifying a player's evaluation strategy. By implementing the IEvaluator interface programmers can create their own custom evaluators and request that a player use the evaluator by calling this method.

Specified by:
setEvaluator in interface IPlayer
Parameters:
evaluator - the strategy used by this player in order to evaluate the current game state.

setCutoff

public void setCutoff(int cutoff)
Description copied from interface: IPlayer
Provides a mechanism for specifying the point at which a player's abandons the search for the best move.

Specified by:
setCutoff in interface IPlayer
Parameters:
cutoff - an integer limiting the duration of a player's search for the best move

takeTurn

public void takeTurn(IBoard board)
              throws TurnException
Prompts the user for the next move via the command line.

Specified by:
takeTurn in interface IPlayer
Parameters:
board - the IBoard object that this player will make a move on.
Throws:
TurnException - if the user enters an invalid move on the command line.

toString

public String toString()
Overrides:
toString in class Object