0
私は3次元ティックタックつま先ゲームを作っています。ゲームは完成して正常に動作しますが、(ゲームの状況をテストするために)プログラムはゲームボード上に小片を配置する整数のファイルを取り込むことを要求しています。 Unixのコマンドラインからファイルを取り込みます。限界を超えて逃げ続ける、なぜか分からない?
ただし、コマンドラインでファイルが入力されていないと、ゲームは最初から実行されるはずです。私は例外の例外を受けていると私の人生の理由を知らない。どんな助けでも大歓迎です。ファイルを取得し、整数を格納するためのコードの
部:
public class Test {
static int board[][][] = new int[4][4][4];
static boolean ComputerMoved = false;
static int[] sums = new int[76];
static int n = 0;
public static void main(String[] args) throws FileNotFoundException {
//Method purpose is to look and see if there is a startup file given to
//initally setup the board. If not, plays an empty board and prompts the
//user for the first move.
Scanner scan = new Scanner(new FileInputStream(args[0]));
if (args.length > 0) {
int size = scan.nextInt();
for (int i = 0; i < size; i++) {
int level = scan.nextInt();
int row = scan.nextInt();
int column = scan.nextInt();
int value = scan.nextInt();
level = level % 4;
row = row % 4;
column = column % 4;
board[level][row][column] = value;
}
}
私は間違ったことを見ます。私は長さをチェックする前に、配列の最初の位置を使用していました。ありがとう! – NoviceProgrammer123