Algorithm
Development Kit 1.0

algs.model.problems.tictactoe.model
Class PlayerFactory

java.lang.Object
  extended by algs.model.problems.tictactoe.model.PlayerFactory

public class PlayerFactory
extends java.lang.Object

Factory to properly construct Player objects representing the type of agents playing TicTacToe.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Field Summary
static java.lang.String AlphaBeta
           
static java.lang.String MiniMax
          Algorithms.
static java.lang.String NegMax
           
static java.lang.String Random
          Known types.
 
Constructor Summary
PlayerFactory()
           
 
Method Summary
static Player createPlayer(java.lang.String type, char mark)
          Create a player just by the type.
static Player createPlayerWithPly(java.lang.String type, char mark, int ply)
          Create player with a fixed ply lookahead.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Random

public static final java.lang.String Random
Known types.

See Also:
Constant Field Values

MiniMax

public static final java.lang.String MiniMax
Algorithms.

See Also:
Constant Field Values

NegMax

public static final java.lang.String NegMax
See Also:
Constant Field Values

AlphaBeta

public static final java.lang.String AlphaBeta
See Also:
Constant Field Values
Constructor Detail

PlayerFactory

public PlayerFactory()
Method Detail

createPlayer

public static Player createPlayer(java.lang.String type,
                                  char mark)
Create a player just by the type.

Parameters:
type - Type of player
mark - X or O mark for player

createPlayerWithPly

public static Player createPlayerWithPly(java.lang.String type,
                                         char mark,
                                         int ply)
Create player with a fixed ply lookahead. Use the default Evaluation scoring method. Note that whoever invokes this method must assign the opponent to be used before that player is asked to determine its moves.

Parameters:
type - Type of player
mark - Mark to use for player
ply - Depth of ply to search.

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.