一个javafx初学者实现国际象棋简单方法(很粗暴)棋子实现不再提供 没有使用java编程思想用的很基础的c语言思想

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Chess;




import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
/**
 *
 * @author teng
 */


public class chessMain extends Application{


    public void start(Stage stage)
    {
        int [][] chessboard=new int[8][8];
        chessboard=createChess();// create the chess listboard
        
        Pane pane=new Pane();
        Chess chess=new Chess(pane);
        
        King [][] king=new King[3][2];
        king[1][1]=new King(pane,3,0,1,0,3,111);
        king[2][1]=new King(pane,3,7,2,7,3,121);
     
        
        Queen [][]queen=new Queen[3][2];
        queen[1][1]=new Queen(pane,4,0,1,0,4,211);
        queen[2][1]=new Queen(pane,4,7,2,7,4,221);
        
        Bishop [][] bishop=new Bishop[3][3];
        bishop[1][1]=new Bishop(pane,2,0,1,0,2,311);
        bishop[1][2]=new Bishop(pane,5,0,1,0,5,312);
        bishop[2][1]=new Bishop(pane,2,7,2,7,2,321);
        bishop[2][2]=new Bishop(pane,5,7,2,7,5,322);
         
        Horse [][]horse=new Horse[3][3];
        horse[1][1]=new Horse(pane,1,0,1,0,1,411);
        horse[1][2]=new Horse(pane,6,0,1,0,6,412);
        horse[2][1]=new Horse(pane,1,7,2,7,1,421);
        horse[2][2]=new Horse(pane,6,7,2,7,6,422);
        
        Rook[][] rook=new Rook[3][3];
        rook[1][1]=new Rook(pane,0,0,1,0,0,511);//black left
        rook[1][2]=new Rook(pane,7,0,1,0,7,512);//      right
        rook[2][1]=new Rook(pane,0,7,2,7,0,521);//white
        rook[2][2]=new Rook(pane,7,7,2,7,7,522);    // right
        
        Pawn [][]pawn=new Pawn[3][9];
        pawn[1][1]=new Pawn(pane,0,1,1,1,0,611);
        pawn[1][2]=new Pawn(pane,1,1,1,1,1,612);
        pawn[1][3]=new Pawn(pane,2,1,1,1,2,613);
        pawn[1][4]=new Pawn(pane,3,1,1,1,3,614);
        pawn[1][5]=new Pawn(pane,4,1,1,1,4,615);
        pawn[1][6]=new Pawn(pane,5,1,1,1,5,616);
        pawn[1][7]=new Pawn(pane,6,1,1,1,6,617);
        pawn[1][8]=new Pawn(pane,7,1,1,1,7,618);
        
        pawn[2][1]=new Pawn(pane,0,6,2,6,0,621);
        pawn[2][2]=new Pawn(pane,1,6,2,6,1,622);
        pawn[2][3]=new Pawn(pane,2,6,2,6,2,623);
        pawn[2][4]=new Pawn(pane,3,6,2,6,3,624);
        pawn[2][5]=new Pawn(pane,4,6,2,6,4,625);
        pawn[2][6]=new Pawn(pane,5,6,2,6,5,626);
        pawn[2][7]=new Pawn(pane,6,6,2,6,6,627);
        pawn[2][8]=new Pawn(pane,7,6,2,6,7,628);
        
        
        moveWhiteKing(king[2][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackKing(king[1][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
          
        moveWhiteQueen(queen[2][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackQueen(queen[1][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        
        moveWhiteBishop(bishop[2][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveWhiteBishop(bishop[2][2],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackBishop(bishop[1][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackBishop(bishop[1][2],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        
        moveWhiteHorse(horse[2][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveWhiteHorse(horse[2][2],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackHorse(horse[1][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackHorse(horse[1][2],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        
        moveWhiteRook(rook[2][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveWhiteRook(rook[2][2],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackRook(rook[1][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackRook(rook[1][2],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        
        
        moveWhitePawn(pawn[2][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveWhitePawn(pawn[2][2],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveWhitePawn(pawn[2][3],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveWhitePawn(pawn[2][4],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveWhitePawn(pawn[2][5],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveWhitePawn(pawn[2][6],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveWhitePawn(pawn[2][7],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveWhitePawn(pawn[2][8],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackPawn(pawn[1][1],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackPawn(pawn[1][2],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackPawn(pawn[1][3],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackPawn(pawn[1][4],pane,king,queen,bishop,horse,rook,pawn,chessboard);
        moveBlackPawn(pawn[1][5],pane,king,queen,bishop,horse,rook,pawn,chessboard);
         moveBlackPawn(pawn[1][6],pane,king,queen,bishop,horse,rook,pawn,chessboard);
          moveBlackPawn(pawn[1][7],pane,king,queen,bishop,horse,rook,pawn,chessboard);
           moveBlackPawn(pawn[1][8],pane,king,queen,bishop,horse,rook,pawn,chessboard);
           
        
        
        
        
        
        Scene scene=new Scene(pane,640,640);
        
        stage.setTitle("chess");
        stage.setScene(scene);
        stage.show();
        stage.setResizable(false);


    }
    
    public static void main(String[] args) {
        
       launch();
    }
    
public int [][] createChess()
{
    int [][] chessboard={
        {511,411,311,111,211,312,412,512},
        {611,612,613,614,615,616,617,618},
        {0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0},
        {0,0,0,0,0,0,0,0},
        {621,622,623,624,625,626,627,628},
        {521,421,321,121,221,322,422,522},
            
    };
    return chessboard;
    
}
public void moveWhiteKing(King king,Pane pane,King[][] kingList,Queen[][] queen,Bishop [][] bishoplist,Horse[][] horse ,Rook[][] rook, Pawn[][] pawn,int [][]chessboard){
         king.king1.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            king.king1.setX(x*80+20);
            king.king1.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==111){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(kingList[1][1].king);
              }
              
               chessboard[y][x]=king.value;
               chessboard[king.nowX][king.nowY]=0;
               king.nowX=y;
               king.nowY=x;


      }
           else if(n==211){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(queen[1][1].queen);
              }
              
               chessboard[y][x]=king.value;
               chessboard[king.nowX][king.nowY]=0;
               king.nowX=y;
               king.nowY=x;
      }
           
           
           
           
           else if(n==311||n==312){
              if(chessboard[y][x]==311){
                  pane.getChildren().remove(bishoplist[1][1].bishop);
              }
              if(chessboard[y][x]==312){
                  pane.getChildren().remove(bishoplist[1][2].bishop);
              }
               chessboard[y][x]=king.value;
      chessboard[king.nowX][king.nowY]=0;
      king.nowX=y;
      king.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==411||n==412){
              if(chessboard[y][x]==411){
                  pane.getChildren().remove(horse[1][1].horse);
              }
              else if(chessboard[y][x]==412){
                  pane.getChildren().remove(horse[1][2].horse);
              }
               chessboard[y][x]=king.value;
               chessboard[king.nowX][king.nowY]=0;
               king.nowX=y;
               king.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==511||n==512)
     {
          if(n==511){
              pane.getChildren().remove(rook[1][1].rook);
                     }
        else if(n==512){
              pane.getChildren().remove(rook[1][2].rook);
                     }
          chessboard[y][x]=king.value;
      chessboard[king.nowX][king.nowY]=0;
      king.nowX=y;
      king.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=611&&n<=618){
              switch(n){
                  case 611:pane.getChildren().remove(pawn[1][1].pawn);break;
                  case 612:pane.getChildren().remove(pawn[1][2].pawn);break;
                  case 613:pane.getChildren().remove(pawn[1][3].pawn);break;
                  case 614:pane.getChildren().remove(pawn[1][4].pawn);break;
                  case 615:pane.getChildren().remove(pawn[1][5].pawn);break;
                  case 616:pane.getChildren().remove(pawn[1][6].pawn);break;
                  case 617:pane.getChildren().remove(pawn[1][7].pawn);break;
                  case 618:pane.getChildren().remove(pawn[1][8].pawn);break;
              }
               chessboard[y][x]=king.value;
               chessboard[king.nowX][king.nowY]=0;
               king.nowX=y;
               king.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               chessboard[y][x]=king.value;
               chessboard[king.nowX][king.nowY]=0;
               king.nowX=y;
               king.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}




public void moveBlackKing(King king,Pane pane,King[][] kingList,Queen[][] queen,Bishop [][] bishoplist,Horse[][] horse ,Rook[][] rook, Pawn[][] pawn,int [][]chessboard){
         king.king.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            king.king.setX(x*80+20);
            king.king.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==121){
              if(chessboard[y][x]==121){
                  pane.getChildren().remove(kingList[2][1].king1);
              }
              
               chessboard[y][x]=king.value;
               chessboard[king.nowX][king.nowY]=0;
               king.nowX=y;
               king.nowY=x;


      }
           else if(n==221){
              if(chessboard[y][x]==221){
                  pane.getChildren().remove(queen[2][1].queen1);
              }
              
               chessboard[y][x]=king.value;
               chessboard[king.nowX][king.nowY]=0;
               king.nowX=y;
               king.nowY=x;
      }
           
           
           
           
           else if(n==321||n==322){
              if(chessboard[y][x]==321){
                  pane.getChildren().remove(bishoplist[2][1].bishop1);
              }
              if(chessboard[y][x]==322){
                  pane.getChildren().remove(bishoplist[2][2].bishop1);
              }
               chessboard[y][x]=king.value;
      chessboard[king.nowX][king.nowY]=0;
      king.nowX=y;
      king.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==421||n==422){
              if(chessboard[y][x]==421){
                  pane.getChildren().remove(horse[2][1].horse1);
              }
              else if(chessboard[y][x]==422){
                  pane.getChildren().remove(horse[2][2].horse1);
              }
               chessboard[y][x]=king.value;
               chessboard[king.nowX][king.nowY]=0;
               king.nowX=y;
               king.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==521||n==522)
     {
          if(n==521){
              pane.getChildren().remove(rook[2][1].rook1);
                     }
        else if(n==522){
              pane.getChildren().remove(rook[2][2].rook1);
                     }
          chessboard[y][x]=king.value;
      chessboard[king.nowX][king.nowY]=0;
      king.nowX=y;
      king.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=621&&n<=628){
              switch(n){
                  case 621:pane.getChildren().remove(pawn[2][1].pawn1);break;
                  case 622:pane.getChildren().remove(pawn[2][2].pawn1);break;
                  case 623:pane.getChildren().remove(pawn[2][3].pawn1);break;
                  case 624:pane.getChildren().remove(pawn[2][4].pawn1);break;
                  case 625:pane.getChildren().remove(pawn[2][5].pawn1);break;
                  case 626:pane.getChildren().remove(pawn[2][6].pawn1);break;
                  case 627:pane.getChildren().remove(pawn[2][7].pawn1);break;
                  case 628:pane.getChildren().remove(pawn[2][8].pawn1);break;
              }
               chessboard[y][x]=king.value;
               chessboard[king.nowX][king.nowY]=0;
               king.nowX=y;
               king.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               chessboard[y][x]=king.value;
               chessboard[king.nowX][king.nowY]=0;
               king.nowX=y;
               king.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}


public void moveWhiteQueen(Queen queen,Pane pane,King[][] kingList,Queen[][] queenList,Bishop [][] bishoplist,Horse[][] horse ,Rook[][] rook, Pawn[][] pawn,int [][]chessboard){
         queen.queen1.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            queen.queen1.setX(x*80+20);
            queen.queen1.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==111){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(kingList[1][1].king);
              }
              
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;


      }
           else if(n==211){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(queenList[1][1].queen);
              }
              
               
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      }
           
           
           
           
           else if(n==311||n==312){
              if(chessboard[y][x]==311){
                  pane.getChildren().remove(bishoplist[1][1].bishop);
              }
              if(chessboard[y][x]==312){
                  pane.getChildren().remove(bishoplist[1][2].bishop);
              }
              
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==411||n==412){
              if(chessboard[y][x]==411){
                  pane.getChildren().remove(horse[1][1].horse);
              }
              else if(chessboard[y][x]==412){
                  pane.getChildren().remove(horse[1][2].horse);
              }
               
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==511||n==512)
     {
          if(n==511){
              pane.getChildren().remove(rook[1][1].rook);
                     }
        else if(n==512){
              pane.getChildren().remove(rook[1][2].rook);
                     }
          
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=611&&n<=618){
              switch(n){
                  case 611:pane.getChildren().remove(pawn[1][1].pawn);break;
                  case 612:pane.getChildren().remove(pawn[1][2].pawn);break;
                  case 613:pane.getChildren().remove(pawn[1][3].pawn);break;
                  case 614:pane.getChildren().remove(pawn[1][4].pawn);break;
                  case 615:pane.getChildren().remove(pawn[1][5].pawn);break;
                  case 616:pane.getChildren().remove(pawn[1][6].pawn);break;
                  case 617:pane.getChildren().remove(pawn[1][7].pawn);break;
                  case 618:pane.getChildren().remove(pawn[1][8].pawn);break;
              }
              
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}
public void moveBlackQueen(Queen queen,Pane pane,King[][] kingList,Queen[][] queenList,Bishop [][] bishoplist,Horse[][] horse ,Rook[][] rook, Pawn[][] pawn,int [][]chessboard){
         queen.queen.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            queen.queen.setX(x*80+20);
            queen.queen.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==121){
              if(chessboard[y][x]==121){
                  pane.getChildren().remove(kingList[2][1].king1);
              }
              
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;


      }
           else if(n==221){
              if(chessboard[y][x]==221){
                  pane.getChildren().remove(queenList[2][1].queen1);
              }
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      }
           
           
           
           
           else if(n==321||n==322){
              if(chessboard[y][x]==321){
                  pane.getChildren().remove(bishoplist[2][1].bishop1);
              }
              if(chessboard[y][x]==322){
                  pane.getChildren().remove(bishoplist[2][2].bishop1);
              }
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==421||n==422){
              if(chessboard[y][x]==421){
                  pane.getChildren().remove(horse[2][1].horse1);
              }
              else if(chessboard[y][x]==422){
                  pane.getChildren().remove(horse[2][2].horse1);
              }
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==521||n==522)
     {
          if(n==521){
              pane.getChildren().remove(rook[2][1].rook1);
                     }
        else if(n==522){
              pane.getChildren().remove(rook[2][2].rook1);
                     }
           chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=621&&n<=628){
              switch(n){
                  case 621:pane.getChildren().remove(pawn[2][1].pawn1);break;
                  case 622:pane.getChildren().remove(pawn[2][2].pawn1);break;
                  case 623:pane.getChildren().remove(pawn[2][3].pawn1);break;
                  case 624:pane.getChildren().remove(pawn[2][4].pawn1);break;
                  case 625:pane.getChildren().remove(pawn[2][5].pawn1);break;
                  case 626:pane.getChildren().remove(pawn[2][6].pawn1);break;
                  case 627:pane.getChildren().remove(pawn[2][7].pawn1);break;
                  case 628:pane.getChildren().remove(pawn[2][8].pawn1);break;
              }
               chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
                chessboard[y][x]=queen.value;
               chessboard[queen.nowX][queen.nowY]=0;
               queen.nowX=y;
               queen.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}


public void moveWhiteBishop(Bishop bishop,Pane pane,King[][] king,Queen[][] queen,Bishop [][] bishoplist,Horse[][] horse ,Rook[][] rook, Pawn[][] pawn,int [][]chessboard){
         bishop.bishop1.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            bishop.bishop1.setX(x*80+20);
            bishop.bishop1.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==111){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(king[1][1].king);
              }
              
               chessboard[y][x]=bishop.value;
               chessboard[bishop.nowX][bishop.nowY]=0;
               bishop.nowX=y;
               bishop.nowY=x;


      }
           
           
           else if(n==211){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(queen[1][1].queen);
              }
              
               chessboard[y][x]=bishop.value;
               chessboard[bishop.nowX][bishop.nowY]=0;
               bishop.nowX=y;
               bishop.nowY=x;
      }
           
           
           
           
           else if(n==311||n==312){
              if(chessboard[y][x]==311){
                  pane.getChildren().remove(bishoplist[1][1].bishop);
              }
              if(chessboard[y][x]==312){
                  pane.getChildren().remove(bishoplist[1][2].bishop);
              }
               chessboard[y][x]=bishop.value;
      chessboard[bishop.nowX][bishop.nowY]=0;
      bishop.nowX=y;
      bishop.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==411||n==412){
              if(chessboard[y][x]==411){
                  pane.getChildren().remove(horse[1][1].horse);
              }
              else if(chessboard[y][x]==412){
                  pane.getChildren().remove(horse[1][2].horse);
              }
               chessboard[y][x]=bishop.value;
               chessboard[bishop.nowX][bishop.nowY]=0;
               bishop.nowX=y;
               bishop.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==511||n==512)
     {
          if(n==511){
              pane.getChildren().remove(rook[1][1].rook);
                     }
        else if(n==512){
              pane.getChildren().remove(rook[1][2].rook);
                     }
      chessboard[y][x]=bishop.value;
      chessboard[bishop.nowX][bishop.nowY]=0;
      bishop.nowX=y;
      bishop.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=611&&n<=618){
              switch(n){
                  case 611:pane.getChildren().remove(pawn[1][1].pawn);break;
                  case 612:pane.getChildren().remove(pawn[1][2].pawn);break;
                  case 613:pane.getChildren().remove(pawn[1][3].pawn);break;
                  case 614:pane.getChildren().remove(pawn[1][4].pawn);break;
                  case 615:pane.getChildren().remove(pawn[1][5].pawn);break;
                  case 616:pane.getChildren().remove(pawn[1][6].pawn);break;
                  case 617:pane.getChildren().remove(pawn[1][7].pawn);break;
                  case 618:pane.getChildren().remove(pawn[1][8].pawn);break;
              }
               chessboard[y][x]=bishop.value;
               chessboard[bishop.nowX][bishop.nowY]=0;
               bishop.nowX=y;
               bishop.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               chessboard[y][x]=bishop.value;
               chessboard[bishop.nowX][bishop.nowY]=0;
               bishop.nowX=y;
               bishop.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}
public void moveBlackBishop(Bishop bishop,Pane pane,King[][] king,Queen[][] queen,Bishop [][] bishoplist,Horse[][] horse ,Rook[][] rook, Pawn[][] pawn,int [][]chessboard){
         bishop.bishop.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            bishop.bishop.setX(x*80+20);
            bishop.bishop.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==121){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(king[2][1].king1);
              }
              
               chessboard[y][x]=bishop.value;
               chessboard[bishop.nowX][bishop.nowY]=0;
               bishop.nowX=y;
               bishop.nowY=x;


      }
           else if(n==221){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(queen[2][1].queen1);
              }
              
               chessboard[y][x]=bishop.value;
               chessboard[bishop.nowX][bishop.nowY]=0;
               bishop.nowX=y;
               bishop.nowY=x;
      }
           
           
           
           
           else if(n==321||n==322){
              if(chessboard[y][x]==321){
                  pane.getChildren().remove(bishoplist[2][1].bishop1);
              }
              if(chessboard[y][x]==322){
                  pane.getChildren().remove(bishoplist[2][2].bishop1);
              }
               chessboard[y][x]=bishop.value;
      chessboard[bishop.nowX][bishop.nowY]=0;
      bishop.nowX=y;
      bishop.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==421||n==422){
              if(chessboard[y][x]==421){
                  pane.getChildren().remove(horse[2][1].horse1);
              }
              else if(chessboard[y][x]==422){
                  pane.getChildren().remove(horse[2][2].horse1);
              }
               chessboard[y][x]=bishop.value;
               chessboard[bishop.nowX][bishop.nowY]=0;
               bishop.nowX=y;
               bishop.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==521||n==522)
     {
          if(n==521){
              pane.getChildren().remove(rook[2][1].rook1);
                     }
        else if(n==522){
              pane.getChildren().remove(rook[2][2].rook1);
                     }
          chessboard[y][x]=bishop.value;
      chessboard[bishop.nowX][bishop.nowY]=0;
      bishop.nowX=y;
      bishop.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=621&&n<=628){
              switch(n){
                  case 621:pane.getChildren().remove(pawn[2][1].pawn1);break;
                  case 622:pane.getChildren().remove(pawn[2][2].pawn1);break;
                  case 623:pane.getChildren().remove(pawn[2][3].pawn1);break;
                  case 624:pane.getChildren().remove(pawn[2][4].pawn1);break;
                  case 625:pane.getChildren().remove(pawn[2][5].pawn1);break;
                  case 626:pane.getChildren().remove(pawn[2][6].pawn1);break;
                  case 627:pane.getChildren().remove(pawn[2][7].pawn1);break;
                  case 628:pane.getChildren().remove(pawn[2][8].pawn1);break;
              }
               chessboard[y][x]=bishop.value;
               chessboard[bishop.nowX][bishop.nowY]=0;
               bishop.nowX=y;
               bishop.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               chessboard[y][x]=bishop.value;
               chessboard[bishop.nowX][bishop.nowY]=0;
               bishop.nowX=y;
               bishop.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}


public void moveWhiteHorse(Horse horse,Pane pane,King[][] kingList,Queen[][] queenList,Bishop [][] bishoplist,Horse[][] horseList ,Rook[][] rook, Pawn[][] pawn,int [][]chessboard)
{
         horse.horse1.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            horse.horse1.setX(x*80+20);
            horse.horse1.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==111){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(kingList[1][1].king);
              }
              
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
              horse.nowY=x;


      }
           else if(n==211){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(queenList[1][1].queen);
              }
              
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
              horse.nowY=x;
      }
           
           
           
           
           else if(n==311||n==312){
              if(chessboard[y][x]==311){
                  pane.getChildren().remove(bishoplist[1][1].bishop);
              }
              if(chessboard[y][x]==312){
                  pane.getChildren().remove(bishoplist[1][2].bishop);
              }
              chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
              horse.nowY=x;
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==411||n==412){
              if(chessboard[y][x]==411){
                  pane.getChildren().remove(horseList[1][1].horse);
              }
              else if(chessboard[y][x]==412){
                  pane.getChildren().remove(horseList[1][2].horse);
              }
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
              horse.nowY=x;
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==511||n==512)
     {
          if(n==511){
              pane.getChildren().remove(rook[1][1].rook);
                     }
        else if(n==512){
              pane.getChildren().remove(rook[1][2].rook);
                     }
          
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
              horse.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=611&&n<=618){
              switch(n){
                  case 611:pane.getChildren().remove(pawn[1][1].pawn);break;
                  case 612:pane.getChildren().remove(pawn[1][2].pawn);break;
                  case 613:pane.getChildren().remove(pawn[1][3].pawn);break;
                  case 614:pane.getChildren().remove(pawn[1][4].pawn);break;
                  case 615:pane.getChildren().remove(pawn[1][5].pawn);break;
                  case 616:pane.getChildren().remove(pawn[1][6].pawn);break;
                  case 617:pane.getChildren().remove(pawn[1][7].pawn);break;
                  case 618:pane.getChildren().remove(pawn[1][8].pawn);break;
              }
              
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
              horse.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               
             chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
              horse.nowY=x;
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}




public void moveBlackHorse(Horse horse ,Pane pane,King[][] kingList,Queen[][] queen,Bishop [][] bishoplist,Horse[][] horseList ,Rook[][] rook, Pawn[][] pawn,int [][]chessboard){
         horse.horse.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            horse.horse.setX(x*80+20);
            horse.horse.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==121){
              if(chessboard[y][x]==121){
                  pane.getChildren().remove(kingList[2][1].king1);
              }
              
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
               horse.nowY=x;


      }
           else if(n==221){
              if(chessboard[y][x]==221){
                  pane.getChildren().remove(queen[2][1].queen1);
              }
              
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
               horse.nowY=x;
      }
           
           
           
           
           else if(n==321||n==322){
              if(chessboard[y][x]==321){
                  pane.getChildren().remove(bishoplist[2][1].bishop1);
              }
              if(chessboard[y][x]==322){
                  pane.getChildren().remove(bishoplist[2][2].bishop1);
              }
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
               horse.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==421||n==422){
              if(chessboard[y][x]==421){
                  pane.getChildren().remove(horseList[2][1].horse1);
              }
              else if(chessboard[y][x]==422){
                  pane.getChildren().remove(horseList[2][2].horse1);
              }
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
               horse.nowY=x;
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==521||n==522)
     {
          if(n==521){
              pane.getChildren().remove(rook[2][1].rook1);
                     }
        else if(n==522){
              pane.getChildren().remove(rook[2][2].rook1);
                     }
          chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
               horse.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=621&&n<=628){
              switch(n){
                  case 621:pane.getChildren().remove(pawn[2][1].pawn1);break;
                  case 622:pane.getChildren().remove(pawn[2][2].pawn1);break;
                  case 623:pane.getChildren().remove(pawn[2][3].pawn1);break;
                  case 624:pane.getChildren().remove(pawn[2][4].pawn1);break;
                  case 625:pane.getChildren().remove(pawn[2][5].pawn1);break;
                  case 626:pane.getChildren().remove(pawn[2][6].pawn1);break;
                  case 627:pane.getChildren().remove(pawn[2][7].pawn1);break;
                  case 628:pane.getChildren().remove(pawn[2][8].pawn1);break;
              }
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
               horse.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               chessboard[y][x]=horse.value;
               chessboard[horse.nowX][horse.nowY]=0;
               horse.nowX=y;
               horse.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}


public void moveWhiteRook(Rook rook,Pane pane,King[][] kingList,Queen[][] queen,Bishop [][] bishoplist,Horse[][] horse ,Rook[][] rookList, Pawn[][] pawn,int [][]chessboard){
         rook.rook1.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            rook.rook1.setX(x*80+20);
            rook.rook1.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==111){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(kingList[1][1].king);
              }
              
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;


      }
           else if(n==211){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(queen[1][1].queen);
              }
              
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      }
           
           
           
           
           else if(n==311||n==312){
              if(chessboard[y][x]==311){
                  pane.getChildren().remove(bishoplist[1][1].bishop);
              }
              if(chessboard[y][x]==312){
                  pane.getChildren().remove(bishoplist[1][2].bishop);
              }
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==411||n==412){
              if(chessboard[y][x]==411){
                  pane.getChildren().remove(horse[1][1].horse);
              }
              else if(chessboard[y][x]==412){
                  pane.getChildren().remove(horse[1][2].horse);
              }
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==511||n==512)
     {
          if(n==511){
              pane.getChildren().remove(rookList[1][1].rook);
                     }
        else if(n==512){
              pane.getChildren().remove(rookList[1][2].rook);
                     }
          chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=611&&n<=618){
              switch(n){
                  case 611:pane.getChildren().remove(pawn[1][1].pawn);break;
                  case 612:pane.getChildren().remove(pawn[1][2].pawn);break;
                  case 613:pane.getChildren().remove(pawn[1][3].pawn);break;
                  case 614:pane.getChildren().remove(pawn[1][4].pawn);break;
                  case 615:pane.getChildren().remove(pawn[1][5].pawn);break;
                  case 616:pane.getChildren().remove(pawn[1][6].pawn);break;
                  case 617:pane.getChildren().remove(pawn[1][7].pawn);break;
                  case 618:pane.getChildren().remove(pawn[1][8].pawn);break;
              }
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}
public void moveBlackRook(Rook rook,Pane pane,King[][] kingList,Queen[][] queen,Bishop [][] bishoplist,Horse[][] horse ,Rook[][] rookList, Pawn[][] pawn,int [][]chessboard){
         rook.rook.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            rook.rook.setX(x*80+20);
            rook.rook.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==121){
              if(chessboard[y][x]==121){
                  pane.getChildren().remove(kingList[2][1].king1);
              }
              
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;


      }
           else if(n==221){
              if(chessboard[y][x]==221){
                  pane.getChildren().remove(queen[2][1].queen1);
              }
              
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      }
           
           
           
           
           else if(n==321||n==322){
              if(chessboard[y][x]==321){
                  pane.getChildren().remove(bishoplist[2][1].bishop1);
              }
              if(chessboard[y][x]==322){
                  pane.getChildren().remove(bishoplist[2][2].bishop1);
              }
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==421||n==422){
              if(chessboard[y][x]==421){
                  pane.getChildren().remove(horse[2][1].horse1);
              }
              else if(chessboard[y][x]==422){
                  pane.getChildren().remove(horse[2][2].horse1);
              }
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==521||n==522)
     {
          if(n==521){
              pane.getChildren().remove(rookList[2][1].rook1);
                     }
        else if(n==522){
              pane.getChildren().remove(rookList[2][2].rook1);
                     }
          chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=621&&n<=628){
              switch(n){
                  case 621:pane.getChildren().remove(pawn[2][1].pawn1);break;
                  case 622:pane.getChildren().remove(pawn[2][2].pawn1);break;
                  case 623:pane.getChildren().remove(pawn[2][3].pawn1);break;
                  case 624:pane.getChildren().remove(pawn[2][4].pawn1);break;
                  case 625:pane.getChildren().remove(pawn[2][5].pawn1);break;
                  case 626:pane.getChildren().remove(pawn[2][6].pawn1);break;
                  case 627:pane.getChildren().remove(pawn[2][7].pawn1);break;
                  case 628:pane.getChildren().remove(pawn[2][8].pawn1);break;
              }
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               chessboard[y][x]=rook.value;
               chessboard[rook.nowX][rook.nowY]=0;
               rook.nowX=y;
               rook.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}


public void moveWhitePawn(Pawn pawn,Pane pane,King[][] kingList,Queen[][] queen,Bishop [][] bishoplist,Horse[][] horse ,Rook[][] rook, Pawn[][] pawnList,int [][]chessboard){
        pawn.pawn1.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            pawn.pawn1.setX(x*80+20);
            pawn.pawn1.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==111){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(kingList[1][1].king);
              }
              
               chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
               pawn.nowX=y;
               pawn.nowY=x;


      }
           else if(n==211){
              if(chessboard[y][x]%10==1){
                  pane.getChildren().remove(queen[1][1].queen);
              }
              
               chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
               pawn.nowX=y;
               pawn.nowY=x;
      }
           
           
           
           
           else if(n==311||n==312){
              if(chessboard[y][x]==311){
                  pane.getChildren().remove(bishoplist[1][1].bishop);
              }
              if(chessboard[y][x]==312){
                  pane.getChildren().remove(bishoplist[1][2].bishop);
              }
              chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
               pawn.nowX=y;
               pawn.nowY=x;
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==411||n==412){
              if(chessboard[y][x]==411){
                  pane.getChildren().remove(horse[1][1].horse);
              }
              else if(chessboard[y][x]==412){
                  pane.getChildren().remove(horse[1][2].horse);
              }
               chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
               pawn.nowX=y;
               pawn.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==511||n==512)
     {
          if(n==511){
              pane.getChildren().remove(rook[1][1].rook);
                     }
        else if(n==512){
              pane.getChildren().remove(rook[1][2].rook);
                     }
         chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
               pawn.nowX=y;
               pawn.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=611&&n<=618){
              switch(n){
                  case 611:pane.getChildren().remove(pawnList[1][1].pawn);break;
                  case 612:pane.getChildren().remove(pawnList[1][2].pawn);break;
                  case 613:pane.getChildren().remove(pawnList[1][3].pawn);break;
                  case 614:pane.getChildren().remove(pawnList[1][4].pawn);break;
                  case 615:pane.getChildren().remove(pawnList[1][5].pawn);break;
                  case 616:pane.getChildren().remove(pawnList[1][6].pawn);break;
                  case 617:pane.getChildren().remove(pawnList[1][7].pawn);break;
                  case 618:pane.getChildren().remove(pawnList[1][8].pawn);break;
              }
               chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
               pawn.nowX=y;
               pawn.nowY=x;
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
               pawn.nowX=y;
               pawn.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}
public void moveBlackPawn(Pawn pawn,Pane pane,King[][] kingList,Queen[][] queen,Bishop [][] bishoplist,Horse[][] horse ,Rook[][] rook, Pawn[][] pawnList,int [][]chessboard){
         pawn.pawn.setOnMouseDragged(e->{
            int x=0,y=0;
            x=(int)e.getX()/80;
            y=(int)e.getY()/80;
            pawn.pawn.setX(x*80+20);
            pawn.pawn.setY(y*80+5);
           int n= chessboard[y][x];
           
           
           if(n==121){
              if(chessboard[y][x]==121){
                  pane.getChildren().remove(kingList[2][1].king1);
              }
              
               chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
              pawn.nowX=y;
               pawn.nowY=x;


      }
           else if(n==221){
              if(chessboard[y][x]==221){
                  pane.getChildren().remove(queen[2][1].queen1);
              }
              
                chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
              pawn.nowX=y;
               pawn.nowY=x;
      }
           
           
           
           
           else if(n==321||n==322){
              if(chessboard[y][x]==321){
                  pane.getChildren().remove(bishoplist[2][1].bishop1);
              }
              if(chessboard[y][x]==322){
                  pane.getChildren().remove(bishoplist[2][2].bishop1);
              }
                chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
              pawn.nowX=y;
               pawn.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
        
           
           
           else if(n==421||n==422){
              if(chessboard[y][x]==421){
                  pane.getChildren().remove(horse[2][1].horse1);
              }
              else if(chessboard[y][x]==422){
                  pane.getChildren().remove(horse[2][2].horse1);
              }
                chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
              pawn.nowX=y;
               pawn.nowY=x;
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
            
           
       
           else if(n==521||n==522)
     {
          if(n==521){
              pane.getChildren().remove(rook[2][1].rook1);
                     }
        else if(n==522){
              pane.getChildren().remove(rook[2][2].rook1);
                     }
          chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
              pawn.nowX=y;
               pawn.nowY=x;
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
    
      
     }
     
           else if(n>=621&&n<=628){
              switch(n){
                  case 621:pane.getChildren().remove(pawnList[2][1].pawn1);break;
                  case 622:pane.getChildren().remove(pawnList[2][2].pawn1);break;
                  case 623:pane.getChildren().remove(pawnList[2][3].pawn1);break;
                  case 624:pane.getChildren().remove(pawnList[2][4].pawn1);break;
                  case 625:pane.getChildren().remove(pawnList[2][5].pawn1);break;
                  case 626:pane.getChildren().remove(pawnList[2][6].pawn1);break;
                  case 627:pane.getChildren().remove(pawnList[2][7].pawn1);break;
                  case 628:pane.getChildren().remove(pawnList[2][8].pawn1);break;
              }
                chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
              pawn.nowX=y;
               pawn.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
           
           
           else if(n==0){
               chessboard[y][x]=pawn.value;
               chessboard[pawn.nowX][pawn.nowY]=0;
              pawn.nowX=y;
               pawn.nowY=x;
      
      for(int i=0;i<8;i++)
      {
          for(int j=0;j<8;j++){
              System.out.print(chessboard[i][j]+"  ");
              
          }
          System.out.println();
      }
      System.out.println();
      }
           
        });


    
    
}
}
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值