Chess.Data.Entities.ChessPiece.GetVerticalMoves C# (CSharp) Method

GetVerticalMoves() protected method

protected GetVerticalMoves ( Square board, int column, int row, int>.List endPositions ) : void
board Square
column int
row int
endPositions int>.List
return void
        protected void GetVerticalMoves(Square[][] board, int column, int row, List<Tuple<int, int>> endPositions)
        {
            ChessPiece occupant;
            for (var c = column; c < 8; c++)
            {
                occupant = board[row][c].ChessPiece;
                if (occupant != null && occupant.Team == Team) break;
                endPositions.Add(new Tuple<int, int>(row, c));
                if (occupant != null && occupant.Team != Team) break;
            }
            for (var c = column; c < 8; c--)
            {
                occupant = board[row][c].ChessPiece;
                if (occupant != null && occupant.Team == Team) break;
                endPositions.Add(new Tuple<int, int>(row, c));
                if (occupant != null && occupant.Team != Team) break;
            }
        }