Class TicTacToePlayer

java.lang.Object
  |
  +--TicTacToePlayer
All Implemented Interfaces:
Player

public class TicTacToePlayer
extends java.lang.Object
implements Player

Tic-Tac-Toe Game:
A Player object represents a player in a grid-based game that acts in response to mouse clicks in the grid.

Version:
May 18, 2004
Author:
Alyce Brady

Constructor Summary
TicTacToePlayer(java.lang.String label, java.awt.Color color)
          Constructs a tic-tac-toe player with the specified label ("O" or "X").
 
Method Summary
 boolean respondToMousePress(edu.kzoo.grid.Grid grid, edu.kzoo.grid.Location loc)
          Responds to mouse press at the specified location in the specified grid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TicTacToePlayer

public TicTacToePlayer(java.lang.String label,
                       java.awt.Color color)
Constructs a tic-tac-toe player with the specified label ("O" or "X").

Parameters:
label - the label for this player ("X" or "O")
color - the color to use when displaying the label
Method Detail

respondToMousePress

public boolean respondToMousePress(edu.kzoo.grid.Grid grid,
                                   edu.kzoo.grid.Location loc)
Responds to mouse press at the specified location in the specified grid.

Specified by:
respondToMousePress in interface Player
Returns:
true if the player was able to play at the specified location; false otherwise