org.moyoman.client.reference
Class InteractiveComputerPlayer

java.lang.Object
  |
  +--org.moyoman.comm.client.Player
        |
        +--org.moyoman.comm.client.ValidatedPlayer
              |
              +--org.moyoman.comm.client.MoyomanPlayer
                    |
                    +--org.moyoman.client.reference.InteractiveComputerPlayer
All Implemented Interfaces:
EventListener, MouseListener

public class InteractiveComputerPlayer
extends MoyomanPlayer
implements MouseListener

Provides an implementation of ValidatedPlayer to allow both mouse input and computer play. The two play modes are toggled by setInteractive(boolean). Interactive as true indicates mouse player mode; false indicates computer player mode.

Since:
v0.15
Version:
v0.15
Author:
Jeffrey M. Thompson

Field Summary
private  boolean _isInteractive
          Flag indicating whether this is in interactive mode.
private  MousePlayer _mousePlayer
          Mouse player.
 
Fields inherited from class org.moyoman.comm.client.MoyomanPlayer
 
Fields inherited from class org.moyoman.comm.client.Player
color, handicap
 
Constructor Summary
InteractiveComputerPlayer(IMoyoman owner, Color color, Handicap handicap, Mode mode, CommandExecutor commandExecutor, boolean isInteractive)
          Construct this object with the given parameters.
 
Method Summary
 void derivedMakeMove(MoveDescriptor md)
          Make a move.
 MoveDescriptor derivedRequestMove()
          Get a move from the player.
 String getIdentifyingInfo()
          Return identifying information about this player.
 void mouseClicked(MouseEvent event)
          Respond to a mouse click.
 void mouseEntered(MouseEvent event)
          Implement the mouse listener inteface.
 void mouseExited(MouseEvent event)
          Implement the mouse listener inteface.
 void mousePressed(MouseEvent event)
          Implement the mouse listener inteface.
 void mouseReleased(MouseEvent event)
          Implement the mouse listener inteface.
 void setInteractive(boolean isInteractive)
          Set the flag which indicates whether this is in interactive mode.
 
Methods inherited from class org.moyoman.comm.client.MoyomanPlayer
getDebuggingInfo, getGameRecord, getId, getMoveNumber, getSuggestedMove, isSelfInitializingUser, listDebuggingModules, requestResignation, setProperties
 
Methods inherited from class org.moyoman.comm.client.ValidatedPlayer
isValidatedUser
 
Methods inherited from class org.moyoman.comm.client.Player
getColor, getHandicap, makeMove, makeMoveNoEvents, registerEndOfGameMoveListener, registerMakeMoveListener, registerRequestMoveListener, requestMove, unregisterEndOfGameListeners, unregisterMakeMoveListeners, unregisterRequestMoveListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_mousePlayer

private MousePlayer _mousePlayer
Mouse player.


_isInteractive

private boolean _isInteractive
Flag indicating whether this is in interactive mode.

Constructor Detail

InteractiveComputerPlayer

public InteractiveComputerPlayer(IMoyoman owner,
                                 Color color,
                                 Handicap handicap,
                                 Mode mode,
                                 CommandExecutor commandExecutor,
                                 boolean isInteractive)
                          throws InternalErrorException
Construct this object with the given parameters.

Parameters:
owner - The owner.
color - The color of the player.
handicap - The handicap of the game.
mode - Computer player mode.
commandExecutor - Command executor.
isInteractive - Flag indicating whether this is in interactive mode initially.
Throws:
InternalErrorException - Thrown if the operation fails for any reason.
Method Detail

getIdentifyingInfo

public String getIdentifyingInfo()
Return identifying information about this player.

Overrides:
getIdentifyingInfo in class MoyomanPlayer
Returns:
An identifying string.
Since:
v0.15

setInteractive

public void setInteractive(boolean isInteractive)
Set the flag which indicates whether this is in interactive mode.


derivedMakeMove

public void derivedMakeMove(MoveDescriptor md)
                     throws IllegalMoveException,
                            InternalErrorException
Make a move. The derived class must implement this method.

Overrides:
derivedMakeMove in class MoyomanPlayer
Parameters:
md - The MoveDescriptor which describes the move to make.
Throws:
IllegalMoveException - Thrown if the move is illegal.
InternalErrorException - Thrown if the operation fails for any reason.

derivedRequestMove

public MoveDescriptor derivedRequestMove()
                                  throws IllegalMoveException,
                                         InternalErrorException
Get a move from the player. The derived class must implement this method.

Overrides:
derivedRequestMove in class MoyomanPlayer
Returns:
A MoveDescriptor object which describes the move.
Throws:
IllegalMoveException - Thrown if the move is illegal.
InternalErrorException - Thrown if the operation fails for any reason.

mouseClicked

public void mouseClicked(MouseEvent event)
Respond to a mouse click.

Specified by:
mouseClicked in interface MouseListener
Since:
v0.15

mouseEntered

public void mouseEntered(MouseEvent event)
Implement the mouse listener inteface.

Specified by:
mouseEntered in interface MouseListener
Parameters:
event - A mouse event.
Since:
v0.15

mouseExited

public void mouseExited(MouseEvent event)
Implement the mouse listener inteface.

Specified by:
mouseExited in interface MouseListener
Parameters:
event - A mouse event.
Since:
v0.15

mousePressed

public void mousePressed(MouseEvent event)
Implement the mouse listener inteface.

Specified by:
mousePressed in interface MouseListener
Parameters:
event - A mouse event.
Since:
v0.15

mouseReleased

public void mouseReleased(MouseEvent event)
Implement the mouse listener inteface.

Specified by:
mouseReleased in interface MouseListener
Parameters:
event - A mouse event.
Since:
v0.15