我希望它循环播放直到删除“ Aw1” /“ Ab1”

时间:2018-12-18 11:53:42

标签: multidimensional-array java.util.scanner

public static String gamePlay(String Player1W, String Player2B){

//loop{
    System.out.println(Player1W + ", please choose a piece to move");
    row = scan.nextInt();
    column = scan.nextInt();
    System.out.println(fullChessBoard[row][column]);

    System.out.println(Player1W + ", please choose where to move");
    row1 = scan.nextInt();
    column1 = scan.nextInt();
    System.out.println(fullChessBoard[row1][column1]);

    if(fullChessBoard[row1][column1] == "   "){
        System.out.println(fullChessBoard[row1][column1] = fullChessBoard[row][column] );
        System.out.println(fullChessBoard[row][column] = "   " );
        for(int x=0; x<fullChessBoard.length; x++){
            for(int y=0; y<fullChessBoard[x].length; y++){
                System.out.print(fullChessBoard[x][y]);
            }
         System.out.println();
        }
    }
    else{
        System.out.println(fullChessBoard[row1][column1] = fullChessBoard[row][column]);
        System.out.println(fullChessBoard[row][column] = "   " );
        for(int x=0; x<fullChessBoard.length; x++){
            for(int y=0; y<fullChessBoard[x].length; y++){
                System.out.print(fullChessBoard[x][y]);
            }
         System.out.println();
        }
    }

    System.out.println(Player2B + ", please choose a piece to move");
    row = scan.nextInt();
    column = scan.nextInt();
    System.out.println(fullChessBoard[row][column]);

    System.out.println(Player2B + ", please choose where to move");
    row1 = scan.nextInt();
    column1 = scan.nextInt();
    System.out.println(fullChessBoard[row1][column1]);

    if(fullChessBoard[row1][column1] == "   "){
        System.out.println(fullChessBoard[row1][column1] = fullChessBoard[row][column] );
        System.out.println(fullChessBoard[row][column] = "   " );
        for(int x=0; x<fullChessBoard.length; x++){
            for(int y=0; y<fullChessBoard[x].length; y++){
                System.out.print(fullChessBoard[x][y]);
            }
         System.out.println();
        }
    }
    else{
        System.out.println(fullChessBoard[row1][column1] = fullChessBoard[row][column]);
        System.out.println(fullChessBoard[row][column] = "   " );
        for(int x=0; x<fullChessBoard.length; x++){
            for(int y=0; y<fullChessBoard[x].length; y++){
                System.out.print(fullChessBoard[x][y]);
            }
         System.out.println();
        }
    }
//}
return result;
}

}

我希望它循环播放直到数组(Aw1 / Ab1)中的数据被删除或等于fullChessBoard [row] [column] 我不知道我应该使用哪种循环,但是仍然不知道该怎么做 是否有可能使数组内的数据成为条件? 真的很需要它 那天我没有吃完饭只是为了完成代码

0 个答案:

没有答案