Ejemplo n.º 1
0
        public void Should_GenerateOneMoveNorthEast()
        {
            // execute
            ChessPosition position = _mover.NorthEast(ChessPosition.B1);

            // verify
            Assert.AreEqual(ChessPosition.C2, position);
        }
Ejemplo n.º 2
0
        private ChessPosition GenerateCaptureEast(IBoardState enemyPieces, IChessPieceMover cpm)
        {
            ChessPosition potentialCapture =
                Color == ChessColor.White ? cpm.NorthEast(Location) : cpm.SouthEast(Location);
            bool isPieceAtCaptureLocation = enemyPieces.Contains(potentialCapture);

            return(isPieceAtCaptureLocation ? potentialCapture : ChessPosition.None);
        }
Ejemplo n.º 3
0
        private void GenerateNorthEastMoves(IBoardState boardState, IChessPieceMover cpm)
        {
            ChessPosition nextMove = cpm.NorthEast(Location);

            if (!boardState.Contains(nextMove))
            {
                MoveSet.Add(nextMove);
            }
        }
Ejemplo n.º 4
0
        private void GenerateEastNorthEastMove(IBoardState boardState, IChessPieceMover cpm)
        {
            ChessPosition move = cpm.East(cpm.NorthEast(Location));

            if (!boardState.Contains(move))
            {
                MoveSet.Add(move);
            }
        }
Ejemplo n.º 5
0
        private void GenerateNorthEastCaptures(IBoardState enemyBoardState, IChessPieceMover cpm)
        {
            ChessPosition capture = cpm.NorthEast(Location);

            AddCaptureToCaptureSet(capture, enemyBoardState);
        }
Ejemplo n.º 6
0
 private ChessPosition GenerateThreatenedEast(IChessPieceMover cpm)
 {
     return(Color == ChessColor.White ? cpm.NorthEast(Location) : cpm.SouthEast(Location));
 }