Example #1
0
 public bool castle(Rook rook, Chessboard cb)
 {
     if (isReadytoCastle() && rook.isReadytoCastle())
     {
         // check which rook
         cb.update(this.xPos, this.yPos, rook.xPos + 1, rook.yPos);
         cb.update(rook.xPos, rook.yPos, this.xPos - 1, this.yPos);
         return(true);
     }
     return(false);
 }
Example #2
0
        public bool move(int Dx, int Dy, Piece destP, Chessboard cb)
        {
            //logic of validity of move goes here and capture
            //if valid return true;
            // else false;
            Console.WriteLine("Pawn moves");
            cb.update(xPos, yPos, Dx, Dy);
            xPos = Dx;
            yPos = Dy;

            return(true);
        }