Beispiel #1
0
        // Pawn Movement validation
        public override bool Move(Board board, Coordinate start, Coordinate end)
        {
            int direction;

            if (this.PieceColor() == "white")
            {
                direction = 1;
            }
            else
            {
                direction = -1;
            }

            if (start.GetY() == end.GetY() &&
                start.GetX() + direction == end.GetX() &&
                board.GetPieceName(start.GetX() + direction, start.GetY()) == "Empty")
            {
                return(true);
            }
            if ((start.GetY() + 1 == end.GetY() || start.GetY() - 1 == end.GetY()) &&
                start.GetX() + direction == end.GetX() &&
                board.GetPieceName(end) != "Empty" && board.GetCoordColor(end) != board.GetCoordColor(start))
            {
                return(true);
            }
            return(false);
        }
Beispiel #2
0
 bool CheckValidColor(Coordinate start)
 {
     if (this.player.CurrentPlayer() == board.GetCoordColor(start))
     {
         return(true);
     }
     return(false);
 }