Esempio n. 1
0
 // make move
 public void makeMove(Move Move)
 {
     board[Move.getNewX(), Move.getNewY()]   = board[Move.getPrevX(), Move.getPrevY()];
     board[Move.getPrevX(), Move.getPrevY()] = null;
     if (Move.getIsBeating())
     {
         if (board[Move.getBeatingX(), Move.getBeatingY()].isFirstPlayer())
         {
             --firstPawns;
         }
         else if (!board[Move.getBeatingX(), Move.getBeatingY()].isFirstPlayer())
         {
             --secondPawns;
         }
         board[Move.getBeatingX(), Move.getBeatingY()] = null;
         if (Move.getNextBeating() != null)
         {
             makeMove(Move.getNextBeating());
         }
         else
         {
             grandForKing(Move.getNewX(), Move.getNewY());
         }
     }
     else
     {
         grandForKing(Move.getNewX(), Move.getNewY());
     }
 }
Esempio n. 2
0
 //deep copy
 public Move(Move move)
 {
     this.prevX       = move.getPrevX();
     this.prevY       = move.getPrevY();
     this.newX        = move.getNewX();
     this.newY        = move.getNewY();
     this.beatenX     = move.getBeatingX();
     this.beatenY     = move.getBeatingY();
     this.isBeating   = move.getIsBeating();
     this.prevBeating = move.getPrevBeating();
     this.nextBeating = move.getNextBeating();
 }