The program does not have an input check at the early phase. A wrong input will lead to program crash. Steps to reproduce: 1. Start the game. 2. Input 0 9 Actual outcome: The game crashes. Expected outcome: The program detects the input is invalid and requests another valid input.
Former partial code: System.out.println("Please input start move"); int start_x = 0; int start_y = 0; if (in.hasNextInt()) { start_x = in.nextInt(); start_y = in.nextInt(); } Point ps = new Point(start_x, start_y); StartMove start_m = new StartMove(ps); New partial code: System.out.println("Please input start move"); int start_x = 0; int start_y = 0; // if start_x or start_y is out of range [0,8] do { if (in.hasNextInt()) { start_x = in.nextInt(); start_y = in.nextInt(); } } while (start_x < 0 || start_x > 8 || start_y < 0 || start_y > 8); Point ps = Graph.getInstance().chessboard[start_x][start_y];