org.vizzini.game.boardgame.chess.action
Class ChessActionFactory

java.lang.Object
  extended by org.vizzini.game.boardgame.chess.action.ChessActionFactory

public class ChessActionFactory
extends Object

Provides a factory for chess actions.

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

Method Summary
 IGridBoardAction getAction(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
          Create and return an action of the type appropriate to the state of the parameters.
 IGridBoardAction getAction(IChessEnvironment board, IChessAgent agent, IntegerPosition kingFromPosition, IntegerPosition kingToPosition, IntegerPosition rookFromPosition, IntegerPosition rookToPosition)
          Create and return an action of the type appropriate to the state of the parameters.
static ChessActionFactory getInstance()
          Return the singleton instance.
protected  Class getPawnPromotionType(IChessAgent agent)
          Return the pawn promotion type desired by the given agent.
protected  boolean isPawnPromotionPossible(IChessEnvironment board, IChessAgent agent, IntegerPosition fromPosition, IntegerPosition toPosition)
          Return true if a pawn promotion is possible using the given parameters.
 void releaseActions(List actions)
          Release the actions in the given list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ChessActionFactory getInstance()
Return the singleton instance.

Since:
v0.3

getAction

public IGridBoardAction getAction(IChessEnvironment board,
                                  IChessAgent agent,
                                  IntegerPosition fromPosition,
                                  IntegerPosition toPosition)
Create and return an action of the type appropriate to the state of the parameters.

Parameters:
board - Chess environment.
agent - Chess agent.
fromPosition - From position.
toPosition - To position.
Since:
v0.3

getAction

public IGridBoardAction getAction(IChessEnvironment board,
                                  IChessAgent agent,
                                  IntegerPosition kingFromPosition,
                                  IntegerPosition kingToPosition,
                                  IntegerPosition rookFromPosition,
                                  IntegerPosition rookToPosition)
Create and return an action of the type appropriate to the state of the parameters.

Parameters:
board - Chess environment.
agent - Chess agent.
kingFromPosition - King from position.
kingToPosition - King to position.
rookFromPosition - Rook from position.
rookToPosition - Rook to position.
Since:
v0.3

releaseActions

public void releaseActions(List actions)
Release the actions in the given list.

Parameters:
actions - Actions list.
Since:
v0.3

getPawnPromotionType

protected Class getPawnPromotionType(IChessAgent agent)
Return the pawn promotion type desired by the given agent.

Parameters:
agent - Chess agent.
Since:
v0.3

isPawnPromotionPossible

protected boolean isPawnPromotionPossible(IChessEnvironment board,
                                          IChessAgent agent,
                                          IntegerPosition fromPosition,
                                          IntegerPosition toPosition)
Return true if a pawn promotion is possible using the given parameters.

Parameters:
board - Grid board.
agent - Agent.
fromPosition - From position.
toPosition - To position.
Since:
v0.3


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02