Example #1
0
        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);
                }
            }
        }
Example #2
0
        public void TestInit()
        {
            _board = _BOARD_FACTORY.GetDefaultBoard();

            _moveModule = _MOVE_MODULE_BUILDER
                            .BoardIs(_board)
                            .Build();
        }
Example #3
0
 public ICpuModuleBuilder MoveModuleIs(IMoveModule module)
 {
     _moveModule = module;
     return this;
 }
Example #4
0
 private CpuModule(IBoard board, IMoveModule moveModule)
 {
     _board = board;
     _moveModule = moveModule;
     SpanTree();
 }
Example #5
0
 public void TestCleanup()
 {
     _moveModule = null;
     _board = null;
 }
Example #6
0
 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);
 }