edu.lhup.ai
Class Factory

java.lang.Object
  |
  +--edu.lhup.ai.Factory
All Implemented Interfaces:
IFactory

public class Factory
extends Object
implements IFactory

A concrete factory that is responsible for creating a game based on the settings and class names specified in an XML file. The following is a sample XML file that creates a game of tic-tac-toe between a RandomPlayer and a MinMaxAlphaBetaPlayer with a cutoff value of 1000 and a default Evaluator:

	<game>
		<gameFactory>
			<boardClass>edu.lhup.ai.tictactoe.Board</boardClass>
			<player>
				<playerClass>edu.lhup.ai.RandomPlayer</playerClass>
			</player>
			<player>
	 		    <playerClass>edu.lhup.ai.MinMaxAlphaBetaPlayer</playerClass>
				<cutoff>1000</cutoff>
				<evaluator>
					<evaluatorClass>edu.lhup.ai.Evaluator</evaluatorClass>
				</evaluator>
			</player>
		</gameFactory>
	</game>
	

This software is for educational purposes only.

Author:
Mark Cohen

Constructor Summary
Factory()
           
 
Method Summary
 IBoard getBoardInstance(String configFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Factory

public Factory()
Method Detail

getBoardInstance

public IBoard getBoardInstance(String configFile)
                        throws StateException
Specified by:
getBoardInstance in interface IFactory
Parameters:
configFile - a resource that contains all the configuration parameters needed to create a game.
Returns:
a game that is ready to be played.
Throws:
StateException - if the configuration files specifies an an invalid game.