void SpanTree(IMoveNode node, int currentDepth) { if (currentDepth == _depth) return; foreach (var piece in node.MoveComposite.Board.Pieces) { var boardCopy = node.MoveComposite.Board.Clone(); _module = MoveModule.GetBuilder().BoardIs(boardCopy).Build(); foreach(var move in _module.AllowedMoves(node.MoveComposite.Move.Piece)) { node.AddChild(MoveNode .GetBuilder() .LevelIs(currentDepth) .MoveCompositeIs(MoveComposite .GetBuilder() .MoveIs(Move .GetBuilder() .PieceIs(piece.Clone()) .TargetIs(move) .Build()) .Build()) .Build()); } foreach(var child in node.Leafs) { SpanTree(child, currentDepth + 1); } } }
public void TestInit() { _board = _BOARD_FACTORY.GetDefaultBoard(); _moveModule = _MOVE_MODULE_BUILDER .BoardIs(_board) .Build(); }
public ICpuModuleBuilder MoveModuleIs(IMoveModule module) { _moveModule = module; return this; }
private CpuModule(IBoard board, IMoveModule moveModule) { _board = board; _moveModule = moveModule; SpanTree(); }
public void TestCleanup() { _moveModule = null; _board = null; }
void Setup() { SetButtons(); _board = BoardFactory.GetFactory().GetDefaultBoard(); _moveModule = MoveModule.GetBuilder().BoardIs(_board).Build(); _buttonHandler = ButtonHandler.GetBuilder().BoardIs(_board).ButtonsAre(_buttons).Build(); _buttonHandler.Update(null, null, null); }