Exemplo n.º 1
0
 /// <summary>
 ///     Adds a capture to the capture set.
 /// </summary>
 /// <param name="capturePosition"></param>
 /// <param name="enemyBoardState"></param>
 protected void AddCaptureToCaptureSet(ChessPosition capturePosition, IBoardState enemyBoardState)
 {
     if (enemyBoardState.Contains(capturePosition))
     {
         CaptureSet.Add(capturePosition);
     }
 }
Exemplo n.º 2
0
 public override void GenerateCaptures(IBoardState boardState, IBoardState owningPlayerBoardState)
 {
     foreach (var capture in TestCaptures)
     {
         CaptureSet.Add(capture);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        ///     Generates all legal <see cref="IPawn" /> captures
        /// </summary>
        /// <param name="boardState">Current board state</param>
        /// <param name="owningPlayerBoardState">State of all of the moving color's pieces</param>
        public override void GenerateCaptures(IBoardState boardState, IBoardState owningPlayerBoardState)
        {
            IChessPieceMover cpm = ModelLocator.ChessPieceMover;

            CaptureSet.Clear();

            IBoardState enemyPieces = CreateEnemyBoardState(boardState, owningPlayerBoardState);

            CaptureSet.Add(GenerateCaptureEast(enemyPieces, cpm));
            CaptureSet.Add(GenerateCaptureWest(enemyPieces, cpm));
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Generates all legal <see cref="Rook" /> captures
        /// </summary>
        /// <param name="boardState"></param>
        /// <param name="owningPlayerBoardState"></param>
        public override void GenerateCaptures(IBoardState boardState, IBoardState owningPlayerBoardState)
        {
            IChessPieceMover cpm = ModelLocator.ChessPieceMover;

            CaptureSet.Clear();
            IBoardState enemyBoardState = CreateEnemyBoardState(boardState, owningPlayerBoardState);

            GenerateNorthCaptures(owningPlayerBoardState, enemyBoardState, cpm);
            GenerateSouthCaptures(owningPlayerBoardState, enemyBoardState, cpm);
            GenerateEastCaptures(owningPlayerBoardState, enemyBoardState, cpm);
            GenerateWestCaptures(owningPlayerBoardState, enemyBoardState, cpm);
        }
Exemplo n.º 5
0
 /// <summary>
 ///     Ensure that <see cref="GenerateCaptures(IBoardState, IBoardState)" /> is called before this.
 /// </summary>
 /// <param name="position"></param>
 /// <returns></returns>
 public bool CanCaptureAt(ChessPosition position)
 {
     return(CaptureSet.Contains(position));
 }