一个让我很不解的问题
请问这是什么意思是在执行时遇到的。
我的程序是这样的
程序代码:
import java.util.Scanner; import java.util.ArrayList; public class PlaneExtra{ private static Scanner scanf=new Scanner(System.in); public static void main (String[] args){ int p1TurnNum = (int)(Math.random()*3); int p2turnNum = (int)(Math.random()*3); int p3turnNum = (int)(Math.random()*3); ArrayList<Integer> p1te = new ArrayList<Integer>(); ArrayList<Integer> p2te = new ArrayList<Integer>(); ArrayList<Integer> p3te = new ArrayList<Integer>(); int p1left = 1; int p2left = 1; int p3left = 1; int pm1 = 1; int pm2 = 1; int pm3 = 1; int[] zb1; zb1 = new int[10]; int[] zb2; zb2 = new int[10]; int[] zb3; zb3 = new int[10]; int[] p1t; p1t = new int[10]; int[] p2t; p2t = new int[10]; int[] p3t; p3t = new int[10]; p1te.add(p1t[0]); p1te.add(p1t[1]); p1te.add(p1t[2]); p1te.add(p1t[3]); p1te.add(p1t[4]); p1te.add(p1t[5]); p1te.add(p1t[6]); p1te.add(p1t[7]); p1te.add(p1t[8]); p1te.add(p1t[9]); p2te.add(p2t[0]); p2te.add(p2t[1]); p2te.add(p2t[2]); p2te.add(p2t[3]); p2te.add(p2t[4]); p2te.add(p2t[5]); p2te.add(p2t[6]); p2te.add(p2t[7]); p2te.add(p2t[8]); p2te.add(p2t[9]); p3te.add(p3t[0]); p3te.add(p3t[1]); p3te.add(p3t[2]); p3te.add(p3t[3]); p3te.add(p3t[4]); p3te.add(p3t[5]); p3te.add(p3t[6]); p3te.add(p3t[7]); p3te.add(p3t[8]); p3te.add(p3t[9]); int p1HitNum = 0; int p2HitNum = 0; int p3HitNum = 0; int KillNum = 0; int GuessNum; boolean flag; do{ flag = false; int t1 =(int)(Math.random()*5 + 1); int t2 =(int)(Math.random()*6 + 1); int t3 =(int)(Math.random()*5 + 4); zb1[1] = t1; zb1[0] = zb1[1] + 2; zb1[2] = zb1[1] + 1; zb1[3] = zb1[1] + 2; zb1[4] = zb1[1] + 3; zb1[5] = zb1[1] + 4; zb1[6] = zb1[1] + 2; zb1[7] = zb1[1] + 1; zb1[8] = zb1[1] + 2; zb1[9] = zb1[1] + 3; zb2[0] = t2; zb2[1] = zb2[0] + 1; zb2[2] = zb2[0] + 1; zb2[3] = zb2[0] + 1; zb2[4] = zb2[0] + 1; zb2[5] = zb2[0] + 1; zb2[6] = zb2[0] + 2; zb2[7] = zb2[0] + 3; zb2[8] = zb2[0] + 3; zb2[9] = zb2[0] + 3; zb3[0] = t3; zb3[1] = zb3[0] - 1; zb3[2] = zb3[0] - 1; zb3[3] = zb3[0] - 1; zb3[4] = zb3[0] - 1; zb3[5] = zb3[0] - 1; zb3[6] = zb3[0] - 2; zb3[7] = zb3[0] - 3; zb3[8] = zb3[0] - 3; zb3[9] = zb3[0] - 3; if ( p1TurnNum == 0 ){ p1t[0] = zb1[0] * 10 + zb2[0]; p1t[1] = zb1[1] * 10 + zb2[1]; p1t[2] = zb1[2] * 10 + zb2[2]; p1t[3] = zb1[3] * 10 + zb2[3]; p1t[4] = zb1[4] * 10 + zb2[4]; p1t[5] = zb1[5] * 10 + zb2[5]; p1t[6] = zb1[6] * 10 + zb2[6]; p1t[7] = zb1[7] * 10 + zb2[7]; p1t[8] = zb1[8] * 10 + zb2[8]; p1t[9] = zb1[9] * 10 + zb2[9]; } if ( p1TurnNum == 1 ){ p1t[0] = zb2[0] * 10 + zb1[0]; p1t[1] = zb2[1] * 10 + zb1[1]; p1t[2] = zb2[2] * 10 + zb1[2]; p1t[3] = zb2[3] * 10 + zb1[3]; p1t[4] = zb2[4] * 10 + zb1[4]; p1t[5] = zb2[5] * 10 + zb1[5]; p1t[6] = zb2[6] * 10 + zb1[6]; p1t[7] = zb2[7] * 10 + zb1[7]; p1t[8] = zb2[8] * 10 + zb1[8]; p1t[9] = zb2[9] * 10 + zb1[9]; } if ( p1TurnNum == 2 ){ p1t[0] = zb3[0] * 10 + zb1[0]; p1t[1] = zb3[1] * 10 + zb1[1]; p1t[2] = zb3[2] * 10 + zb1[2]; p1t[3] = zb3[3] * 10 + zb1[3]; p1t[4] = zb3[4] * 10 + zb1[4]; p1t[5] = zb3[5] * 10 + zb1[5]; p1t[6] = zb3[6] * 10 + zb1[6]; p1t[7] = zb3[7] * 10 + zb1[7]; p1t[8] = zb3[8] * 10 + zb1[8]; p1t[9] = zb3[9] * 10 + zb1[9]; } if ( p1TurnNum == 3 ){ p1t[0] = zb1[0] * 10 + zb3[0]; p1t[1] = zb1[1] * 10 + zb3[1]; p1t[2] = zb1[2] * 10 + zb3[2]; p1t[3] = zb1[3] * 10 + zb3[3]; p1t[4] = zb1[4] * 10 + zb3[4]; p1t[5] = zb1[5] * 10 + zb3[5]; p1t[6] = zb1[6] * 10 + zb3[6]; p1t[7] = zb1[7] * 10 + zb3[7]; p1t[8] = zb1[8] * 10 + zb3[8]; p1t[9] = zb1[9] * 10 + zb3[9]; } if ( p2turnNum == 0 ){ p2t[0] = zb1[0] * 10 + zb2[0]; p2t[1] = zb1[1] * 10 + zb2[1]; p2t[2] = zb1[2] * 10 + zb2[2]; p2t[3] = zb1[3] * 10 + zb2[3]; p2t[4] = zb1[4] * 10 + zb2[4]; p2t[5] = zb1[5] * 10 + zb2[5]; p2t[6] = zb1[6] * 10 + zb2[6]; p2t[7] = zb1[7] * 10 + zb2[7]; p2t[8] = zb1[8] * 10 + zb2[8]; p2t[9] = zb1[9] * 10 + zb2[9]; } if ( p2turnNum == 1 ){ p2t[0] = zb2[0] * 10 + zb1[0]; p2t[1] = zb2[1] * 10 + zb1[1]; p2t[2] = zb2[2] * 10 + zb1[2]; p2t[3] = zb2[3] * 10 + zb1[3]; p2t[4] = zb2[4] * 10 + zb1[4]; p2t[5] = zb2[5] * 10 + zb1[5]; p2t[6] = zb2[6] * 10 + zb1[6]; p2t[7] = zb2[7] * 10 + zb1[7]; p2t[8] = zb2[8] * 10 + zb1[8]; p2t[9] = zb2[9] * 10 + zb1[9]; } if ( p2turnNum == 2 ){ p2t[0] = zb3[0] * 10 + zb1[0]; p2t[1] = zb3[1] * 10 + zb1[1]; p2t[2] = zb3[2] * 10 + zb1[2]; p2t[3] = zb3[3] * 10 + zb1[3]; p2t[4] = zb3[4] * 10 + zb1[4]; p2t[5] = zb3[5] * 10 + zb1[5]; p2t[6] = zb3[6] * 10 + zb1[6]; p2t[7] = zb3[7] * 10 + zb1[7]; p2t[8] = zb3[8] * 10 + zb1[8]; p2t[9] = zb3[9] * 10 + zb1[9]; } if ( p2turnNum == 3 ){ p2t[0] = zb1[0] * 10 + zb3[0]; p2t[1] = zb1[1] * 10 + zb3[1]; p2t[2] = zb1[2] * 10 + zb3[2]; p2t[3] = zb1[3] * 10 + zb3[3]; p2t[4] = zb1[4] * 10 + zb3[4]; p2t[5] = zb1[5] * 10 + zb3[5]; p2t[6] = zb1[6] * 10 + zb3[6]; p2t[7] = zb1[7] * 10 + zb3[7]; p2t[8] = zb1[8] * 10 + zb3[8]; p2t[9] = zb1[9] * 10 + zb3[9]; } if ( p3turnNum == 0 ){ p3t[0] = zb1[0] * 10 + zb2[0]; p3t[1] = zb1[1] * 10 + zb2[1]; p3t[2] = zb1[2] * 10 + zb2[2]; p3t[3] = zb1[3] * 10 + zb2[3]; p3t[4] = zb1[4] * 10 + zb2[4]; p3t[5] = zb1[5] * 10 + zb2[5]; p3t[6] = zb1[6] * 10 + zb2[6]; p3t[7] = zb1[7] * 10 + zb2[7]; p3t[8] = zb1[8] * 10 + zb2[8]; p3t[9] = zb1[9] * 10 + zb2[9]; } if ( p3turnNum == 1 ){ p3t[0] = zb2[0] * 10 + zb1[0]; p3t[1] = zb2[1] * 10 + zb1[1]; p3t[2] = zb2[2] * 10 + zb1[2]; p3t[3] = zb2[3] * 10 + zb1[3]; p3t[4] = zb2[4] * 10 + zb1[4]; p3t[5] = zb2[5] * 10 + zb1[5]; p3t[6] = zb2[6] * 10 + zb1[6]; p3t[7] = zb2[7] * 10 + zb1[7]; p3t[8] = zb2[8] * 10 + zb1[8]; p3t[9] = zb2[9] * 10 + zb1[9]; } if ( p3turnNum == 2 ){ p3t[0] = zb3[0] * 10 + zb1[0]; p3t[1] = zb3[1] * 10 + zb1[1]; p3t[2] = zb3[2] * 10 + zb1[2]; p3t[3] = zb3[3] * 10 + zb1[3]; p3t[4] = zb3[4] * 10 + zb1[4]; p3t[5] = zb3[5] * 10 + zb1[5]; p3t[6] = zb3[6] * 10 + zb1[6]; p3t[7] = zb3[7] * 10 + zb1[7]; p3t[8] = zb3[8] * 10 + zb1[8]; p3t[9] = zb3[9] * 10 + zb1[9]; } if ( p3turnNum == 3 ){ p3t[0] = zb1[0] * 10 + zb3[0]; p3t[1] = zb1[1] * 10 + zb3[1]; p3t[2] = zb1[2] * 10 + zb3[2]; p3t[3] = zb1[3] * 10 + zb3[3]; p3t[4] = zb1[4] * 10 + zb3[4]; p3t[5] = zb1[5] * 10 + zb3[5]; p3t[6] = zb1[6] * 10 + zb3[6]; p3t[7] = zb1[7] * 10 + zb3[7]; p3t[8] = zb1[8] * 10 + zb3[8]; p3t[9] = zb1[9] * 10 + zb3[9]; } for (int p1r : p1t){ for (int p2r : p2t ){ for (int p3r : p3t) if ( p1r == p2r | p2r == p3r | p1r == p3r) { flag = true; } } } }while(flag); System.out.println("Please tell me you answer. If system doesn't reply anything , it means that your answer is wrong."); System.out.println("Plane One is" +p1t[0]); System.out.println("Plane One is" +p1t[1]); System.out.println("Plane One is" +p1t[2]); System.out.println("Plane One is" +p1t[3]); System.out.println("Plane One is" +p1t[4]); System.out.println("Plane One is" +p1t[5]); System.out.println("Plane One is" +p1t[6]); System.out.println("Plane One is" +p1t[7]); System.out.println("Plane One is" +p1t[8]); System.out.println("Plane One is" +p1t[9]); System.out.println("Plane Two is" +p2t[0]); System.out.println("Plane Two is" +p2t[1]); System.out.println("Plane Two is" +p2t[2]); System.out.println("Plane Two is" +p2t[3]); System.out.println("Plane Two is" +p2t[4]); System.out.println("Plane Two is" +p2t[5]); System.out.println("Plane Two is" +p2t[6]); System.out.println("Plane Two is" +p2t[7]); System.out.println("Plane Two is" +p2t[8]); System.out.println("Plane Two is" +p2t[9]); System.out.println("Plane Three is" +p3t[0]); System.out.println("Plane Three is" +p3t[1]); System.out.println("Plane Three is" +p3t[2]); System.out.println("Plane Three is" +p3t[3]); System.out.println("Plane Three is" +p3t[4]); System.out.println("Plane Three is" +p3t[5]); System.out.println("Plane Three is" +p3t[6]); System.out.println("Plane Three is" +p3t[7]); System.out.println("Plane Three is" +p3t[8]); System.out.println("Plane Three is" +p3t[9]); while(KillNum < 3){ System.out.println("Plane one Hit Number is " +p1HitNum); System.out.println("Plane two Hit Number is " +p2HitNum); System.out.println("Plane three Hit Number is " +p3HitNum); GuessNum = scanf.nextInt(); if ( GuessNum == p1t[1] ){ p1te.remove(p1t[1]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p1t[2] ){ p1te.remove(p1t[2]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p1t[3] ){ p1te.remove(p1t[3]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p1t[4] ){ p1te.remove(p1t[4]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p1t[5] ){ p1te.remove(p1t[5]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p1t[6] ){ p1te.remove(p1t[1]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p1t[7] ){ p1te.remove(p1t[7]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p1t[8] ){ p1te.remove(p1t[8]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p1t[9] ){ p1te.remove(p1t[9]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p1t[0] ){ p1te.remove(p1t[0]); p1HitNum++; KillNum++; pm1--; System.out.println("You Kill The Plane One! :->"); } if ( pm1 == 1 && p1HitNum == 9){ KillNum++; p1te.remove(p1t[0]); System.out.println("You Kill The Plane One! :->"); } if ( GuessNum == p2t[1] ){ p1te.remove(p2t[1]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p2t[2] ){ p2te.remove(p2t[2]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p2t[3] ){ p2te.remove(p2t[3]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p2t[4] ){ p2te.remove(p2t[4]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p2t[5] ){ p2te.remove(p2t[5]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p2t[6] ){ p2te.remove(p2t[6]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p2t[7] ){ p2te.remove(p2t[7]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p2t[8] ){ p2te.remove(p2t[8]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p2t[9] ){ p2te.remove(p2t[9]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p2t[0] ){ p2te.remove(p2t[0]); p1HitNum++; KillNum++; pm2--; System.out.println("You Kill The Plane Two!:->"); } if ( pm2 == 1 && p2HitNum == 9){ KillNum++; p2te.remove(p2t[0]); System.out.println("You Kill The Plane Two! :->"); } if ( GuessNum == p3t[1] ){ p3te.remove(p3t[1]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p3t[2] ){ p3te.remove(p3t[2]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p3t[3] ){ p3te.remove(p3t[3]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p3t[4] ){ p3te.remove(p3t[4]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p3t[5] ){ p3te.remove(p3t[5]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p3t[6] ){ p3te.remove(p3t[6]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p3t[7] ){ p3te.remove(p3t[7]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p3t[8] ){ p3te.remove(p3t[8]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p3t[9] ){ p3te.remove(p3t[9]); p1HitNum++; System.out.println("Hit"); } if ( GuessNum == p3t[0] ){ p3te.remove(p3t[0]); p1HitNum++; KillNum++; pm2--; System.out.println("You Kill The Plane Three!:->"); } if ( pm3 == 1 && p1HitNum == 9){ KillNum++; p3te.remove(p3t[0]); System.out.println("You Kill The Plane Three! :->"); } } System.out.println("You Win The Game! :-O"); } }
可能比较磨叽,但多谢了。