示例#1
0
        private static PieceMinified CheckDirection(PieceMinified piece, BoardMinified board, sbyte directionRight,
                                                    sbyte directionDown)
        {
            var target = board.GetBoardCell((byte)(piece.X + directionRight), (byte)(piece.Y + directionDown));

            if (!target.IsEmpty() && target.IsWhite() != piece.IsWhite)
            {
                var second = board.GetBoardCell((byte)(piece.X + 2 * directionRight),
                                                (byte)(piece.Y + 2 * directionDown));
                if (second.IsEmpty())
                {
                    piece.AddAvailableMove(directionRight, directionDown, true);
                }
            }

            return(piece);
        }
        public PieceMinified Check(PieceMinified piece, BoardMinified board, sbyte directionDown, sbyte directionRight)
        {
            var boardCell = board.GetBoardCell((byte)(piece.X + directionRight), (byte)(piece.Y + directionDown));

            if (boardCell.IsEmpty())
            {
                piece.AddAvailableMove(directionRight, directionDown, false);
            }
            return(piece);
        }