Packagecom.lookbackon.AI.searching
Classpublic class SearchingBase
InheritanceSearchingBase Inheritance AbstractProcess Inheritance Object
Implements ISearching
Subclasses AlphaBeta, AttackFalse, MiniMax, MinMax, NegaMax, NegaScout, PVS, Quiescence, RandomWalk, ShortSighted



Public Properties
 PropertyDefined By
  captures : Vector.<ConductVO>
[read-only] This function generates all possible captures and stores them in the vector. It returns the vector of the legal captures for Quiescene searching.
SearchingBase
  evaluation : IEvaluation
SearchingBase
 InheritedisSelfManaging : Boolean
AbstractProcess
  moves : Vector.<ConductVO>
[read-only]
SearchingBase
  orderingMoves : Vector.<ConductVO>
Ordering Moves To Speed Up Search As we will see next time, search efficiency depends on the order in which moves are searched. The gains and losses related to good or poor move ordering are not trivial: a good ordering, defined as one which will cause a large number of cutoffs, will result in a search tree about the square root of the size of the tree associated with the worst possible ordering! Unfortunately, it turns out that the best possible ordering is simply defined by trying the best move first.
SearchingBase
  percentage : Number
[override] [read-only] inheritDoc
SearchingBase
  processDone : Boolean
SearchingBase
Protected Properties
 PropertyDefined By
  alpha : int
SearchingBase
  bestMove : ConductVO
SearchingBase
  bestValue : int
SearchingBase
  beta : int
SearchingBase
  chessBoardModel : ChessBoardModel
SearchingBase
  chessGasketsModel : ChessGasketsModel
SearchingBase
  chessPiecesModel : ChessPiecesModel
SearchingBase
  depth : int
SearchingBase
  gamePosition : PositionVO
SearchingBase
  generatedMoves : Vector.<ConductVO>
SearchingBase
 Inherited_isSelfManaging : Boolean
AbstractProcess
  positionEvaluated : int
SearchingBase
  tempCapture : ConductVO
SearchingBase
  tempMove : ConductVO
SearchingBase
  tempValue : int
SearchingBase
Public Methods
 MethodDefined By
  
SearchingBase(gamePosition:PositionVO, isSelfManaging:Boolean = false)
To sum up this in one sentence: Computers play strategy games by generating all possible continuations up to a (more or less) fixed depth and evaluating the resulting positions, which allows them to choose the best of these continuations.
SearchingBase
  
applyMove(conductVO:ConductVO):void
SearchingBase
  
doEvaluation(conductVO:ConductVO, gamePosition:PositionVO):int
The evaluation function will return positive values if the position is good for red and negative values. if the position is bad for red in the MinMax formulation. Many things could be said about evaluation functions, for me,the two main objectives in designing a evaluation function are speed and accuracy. The faster your evaluation function is,the better is. and the more accurate its evaluation is,the beeter. Obviously,these two things are somewhat at odds: an accurate evaluation function probably is slower than a 'quick-and-dirty' one. The evaluation function I'm taking about here is a heuristic one -not a exact one.
SearchingBase
  
generateMoves(pieces:Vector.<ChessPiece>):Vector.<ConductVO>
This function generates all possible moves and stores them in the vector. It returns the vector of the legal moves. While is checking,defend moves with high priority.
SearchingBase
  
makeMove(conductVO:ConductVO):void
Obviously,the struct move must contain all information necessary to support this operations. As always,the structures are passed by reference, in this case it is not only a speed question: the position will be modified by this functions.
SearchingBase
  
noneMove():int
SearchingBase
  
run():void
[override] inheritDoc
SearchingBase
 Inherited
runAndManage(allocation:int):void
AbstractProcess
 Inherited
terminate():void
AbstractProcess
  
unmakeMove(conductVO:ConductVO):void
Unmake previous move,for all kinds of searching tree algorithms.
SearchingBase
  
willNoneMove(gamePosition:PositionVO):Boolean
SearchingBase
 Inherited
yield():void
AbstractProcess
Public Constants
 ConstantDefined By
  MAX_SEARCH_DEPTH : int = 5
SearchingBase
Property Detail
alphaproperty
protected var alpha:int

bestMoveproperty 
protected var bestMove:ConductVO

bestValueproperty 
protected var bestValue:int

betaproperty 
protected var beta:int

capturesproperty 
captures:Vector.<ConductVO>  [read-only]

This function generates all possible captures and stores them in the vector. It returns the vector of the legal captures for Quiescene searching.


Implementation
    public function get captures():Vector.<ConductVO>
chessBoardModelproperty 
protected var chessBoardModel:ChessBoardModel

chessGasketsModelproperty 
protected var chessGasketsModel:ChessGasketsModel

chessPiecesModelproperty 
protected var chessPiecesModel:ChessPiecesModel

depthproperty 
protected var depth:int

evaluationproperty 
evaluation:IEvaluation


Implementation
    public function get evaluation():IEvaluation
    public function set evaluation(value:IEvaluation):void
gamePositionproperty 
protected var gamePosition:PositionVO

generatedMovesproperty 
protected var generatedMoves:Vector.<ConductVO>

movesproperty 
moves:Vector.<ConductVO>  [read-only]


Implementation
    public function get moves():Vector.<ConductVO>
orderingMovesproperty 
orderingMoves:Vector.<ConductVO>


Implementation
    public function get orderingMoves():Vector.<ConductVO>
    public function set orderingMoves(value:Vector.<ConductVO>):void

See also

percentageproperty 
percentage:Number  [read-only] [override]

inheritDoc


Implementation
    public function get percentage():Number
positionEvaluatedproperty 
protected var positionEvaluated:int

processDoneproperty 
processDone:Boolean


Implementation
    public function get processDone():Boolean
    public function set processDone(value:Boolean):void
tempCaptureproperty 
protected var tempCapture:ConductVO

tempMoveproperty 
protected var tempMove:ConductVO

tempValueproperty 
protected var tempValue:int

Constructor Detail
SearchingBase()Constructor
public function SearchingBase(gamePosition:PositionVO, isSelfManaging:Boolean = false)



Parameters
gamePosition:PositionVO
 
isSelfManaging:Boolean (default = false)
Method Detail
applyMove()method
public final function applyMove(conductVO:ConductVO):void

Parameters

conductVO:ConductVO

doEvaluation()method 
public function doEvaluation(conductVO:ConductVO, gamePosition:PositionVO):int

The evaluation function will return positive values if the position is good for red and negative values. if the position is bad for red in the MinMax formulation. Many things could be said about evaluation functions, for me,the two main objectives in designing a evaluation function are speed and accuracy. The faster your evaluation function is,the better is. and the more accurate its evaluation is,the beeter. Obviously,these two things are somewhat at odds: an accurate evaluation function probably is slower than a 'quick-and-dirty' one. The evaluation function I'm taking about here is a heuristic one -not a exact one.

Parameters

conductVO:ConductVO — the current condutVO value.
 
gamePosition:PositionVO — the current game board positon info.

Returns
int — evaluation result

See also

generateMoves()method 
public final function generateMoves(pieces:Vector.<ChessPiece>):Vector.<ConductVO>

This function generates all possible moves and stores them in the vector. It returns the vector of the legal moves. While is checking,defend moves with high priority.

Parameters

pieces:Vector.<ChessPiece> — chess pieces collection.

Returns
Vector.<ConductVO> — all possible moves.
makeMove()method 
public final function makeMove(conductVO:ConductVO):void

Parameters

conductVO:ConductVO

noneMove()method 
public final function noneMove():int

Returns
int
run()method 
override public function run():void

inheritDoc

unmakeMove()method 
public final function unmakeMove(conductVO:ConductVO):void

Unmake previous move,for all kinds of searching tree algorithms.

Parameters

conductVO:ConductVO

willNoneMove()method 
public final function willNoneMove(gamePosition:PositionVO):Boolean

Parameters

gamePosition:PositionVO

Returns
Boolean
Constant Detail
MAX_SEARCH_DEPTHConstant
public const MAX_SEARCH_DEPTH:int = 5