Example #1
0
        public bool ExecuteMove(MyChessEngineBase.Move move)
        {
            Board.ExecuteMove(new Move(move));

            ColorToMove = ChessEngineConstants.NextColorToMove(ColorToMove);

            return(true);
        }
Example #2
0
        public void CalculateOneMoveMate1()
        {
            ChessEngineInteger chessEngineInteger = new ChessEngineInteger
            {
                ["G6"] = new King(Color.White, MoveType.Normal),
                ["H8"] = new King(Color.Black, MoveType.Normal),
                ["A1"] = new Rook(Color.White)
            };

            MyChessEngineBase.Move move = chessEngineInteger.CalculateMove();

            Assert.IsTrue(move.End.AreEqual(new Position("A8")));
        }
Example #3
0
        public void CheckBoardRatingBlackMateCalculateMove()
        {
            ChessEngineInteger chessEngineInteger = new ChessEngineInteger
            {
                ["G6"]      = new King(Color.White, MoveType.Normal),
                ["A8"]      = new Rook(Color.White),
                ["H8"]      = new King(Color.Black, MoveType.Normal),
                ColorToMove = Color.Black
            };

            MyChessEngineBase.Move move = chessEngineInteger.CalculateMove();
            Assert.IsNotNull(move);
        }
Example #4
0
        private MyChessEngineBase.Move MoveToMove(Move move)
        {
            if (move.StartRow < 0)
            {
                return(MyChessEngineBase.Move.CreateNoMove(move.Rating));
            }

            MyChessEngineBase.Move resultMove = new MyChessEngineBase.Move(
                new Position(move.StartColumn, move.StartColumn),
                new Position(move.EndRow, move.EndColumn),
                new Piece(Board[move.StartRow, move.StartColumn]),
                move.MoveType)
            {
                Rating = move.Rating
            };

            return(resultMove);
        }
Example #5
0
 public Move(MyChessEngineBase.Move move) : this(move.Start.Row, move.Start.Column, move.End.Row, move.End.Column,
                                                 move.Type, move.Rating)
 {
 }