private Position[] AddCollisionPawn(ChessPiece CurrentPiece) { Position[] allTurns = CurrentPiece.PossibleTurns().SelectMany(x => x).ToArray(); List <Position> Builder = new List <Position>(); if (allTurns.Length == 0) { // Change to any piece except pawn and king } else { //Check forward, left forward, right forward foreach (Position forwardDirection in allTurns) { if (this[forwardDirection] == null) { Builder.Add(forwardDirection); } else { break; } } Position forward = allTurns[0]; //If there're pieces right or left corners, take them. Position ForwardLeft = forward.ToLeft(CurrentPiece.Color); if (ForwardLeft.IsOnBoard()) { ChessPiece PieceForwardLeft = this[ForwardLeft]; if (PieceForwardLeft != null && PieceForwardLeft.Color != CurrentPiece.Color) { Builder.Add(ForwardLeft); } } Position ForwardRight = forward.ToRight(CurrentPiece.Color); if (ForwardRight.IsOnBoard()) { ChessPiece PieceForwardRight = this[ForwardRight]; if (PieceForwardRight != null && PieceForwardRight.Color != CurrentPiece.Color) { Builder.Add(ForwardRight); } } } return(Builder.ToArray()); }