Class PokerSquares

java.lang.Object
  extended by PokerSquares

public class PokerSquares
extends java.lang.Object


Field Summary
static long GAME_MILLIS
           
static int SIZE
           
 
Constructor Summary
PokerSquares(PokerSquaresPlayer player, long gameMillis)
           
 
Method Summary
static int getHandScore(Card[] hand)
          Get the score of the given Card hand.
static int[] getHandScores(Card[][] grid)
          Get an int array with the individual hand scores of rows 0 through 4 followed by columns 0 through 4.
static int getScore(Card[][] grid)
          Get the score of the given Card grid.
static void main(java.lang.String[] args)
          Demonstrate testing of a PokerSquaresPlayer.
 int play()
          Play a game of Poker Squares with the given PokerSquaresPlayer and time limit, returning the game score.
 int[] playSequence(int numGames, long startSeed, boolean verbose)
          Play a sequence of games, collecting and reporting statistics.
static void printGrid(Card[][] grid)
          Print the current game grid and score.
static void scoreTest()
          Test the correctness of scoring code.
 void setSeed(long seed)
          Set the seed of the game pseudorandom number generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZE

public static final int SIZE
See Also:
Constant Field Values

GAME_MILLIS

public static final long GAME_MILLIS
See Also:
Constant Field Values
Constructor Detail

PokerSquares

public PokerSquares(PokerSquaresPlayer player,
                    long gameMillis)
Parameters:
player - Poker Squares player object
gameMillis - maximum milliseconds permitted for game
Method Detail

play

public int play()
Play a game of Poker Squares with the given PokerSquaresPlayer and time limit, returning the game score.

Returns:
final game score

playSequence

public int[] playSequence(int numGames,
                          long startSeed,
                          boolean verbose)
Play a sequence of games, collecting and reporting statistics.

Parameters:
numGames - number of games to play
startSeed - seed of first game. Successive games use successive seeds
verbose - whether or not to provide verbose output of game play
Returns:
integer array of game scores

printGrid

public static void printGrid(Card[][] grid)
Print the current game grid and score.

Parameters:
grid - current game grid

getScore

public static int getScore(Card[][] grid)
Get the score of the given Card grid.

Parameters:
grid - Card grid
Returns:
score of given Card grid

getHandScores

public static int[] getHandScores(Card[][] grid)
Get an int array with the individual hand scores of rows 0 through 4 followed by columns 0 through 4.

Parameters:
grid - 2D Card array representing play grid
Returns:
an int array with the individual hand scores of rows 0 through 4 followed by columns 0 through 4.

getHandScore

public static int getHandScore(Card[] hand)
Get the score of the given Card hand.

Parameters:
hand - Card hand
Returns:
score of given Card hand.

setSeed

public void setSeed(long seed)
Set the seed of the game pseudorandom number generator.

Parameters:
seed - pseudorandom number generator seed

scoreTest

public static void scoreTest()
Test the correctness of scoring code.


main

public static void main(java.lang.String[] args)
Demonstrate testing of a PokerSquaresPlayer.

Parameters:
args -