Summary: The bug is found after the user chooses the map he wants to play. Steps to Reproduce: 1. Run the program; 2. Input preferred map "1" Actual Results: Please choose the map you want to play(eg: 1): 2 Refreshing the map 1 2 3 4 5 6 7 8 /---------------- 1|& @ $ % 5 @ $ 2 2|# % $ # $ $ 1 @ 3|& # % 1 & $ # & 4|@ % 2 ~ ~ 4 @ & 5|$ % & ~ ~ $ & # 6|1 # # 3 @ % % & 7|# & & $ & & @ # 8|# $ # & $ % # $ Please enter your move(eg: 1 3 W): Please enter your move(eg: 1 3 W): Expected Results: Please choose the map you want to play(eg: 1): 2 Refreshing the map 1 2 3 4 5 6 7 8 /---------------- 1|& @ $ % 5 @ $ 2 2|# % $ # $ $ 1 @ 3|& # % 1 & $ # & 4|@ % 2 ~ ~ 4 @ & 5|$ % & ~ ~ $ & # 6|1 # # 3 @ % % & 7|# & & $ & & @ # 8|# $ # & $ % # $ Please enter your move(eg: 1 3 W):
Created attachment 63 [details] This is the class where the bug comes from
(In reply to jli262-c from comment #0) > Summary: > The bug is found after the user chooses the map he wants to play. > > Steps to Reproduce: > 1. Run the program; > 2. Input preferred map "1" > > Actual Results: > Please choose the map you want to play(eg: 1): > 2 > Refreshing the map > 1 2 3 4 5 6 7 8 > /---------------- > 1|& @ $ % 5 @ $ 2 > 2|# % $ # $ $ 1 @ > 3|& # % 1 & $ # & > 4|@ % 2 ~ ~ 4 @ & > 5|$ % & ~ ~ $ & # > 6|1 # # 3 @ % % & > 7|# & & $ & & @ # > 8|# $ # & $ % # $ > > Please enter your move(eg: 1 3 W): > Please enter your move(eg: 1 3 W): > > Expected Results: > Please choose the map you want to play(eg: 1): > 2 > Refreshing the map > 1 2 3 4 5 6 7 8 > /---------------- > 1|& @ $ % 5 @ $ 2 > 2|# % $ # $ $ 1 @ > 3|& # % 1 & $ # & > 4|@ % 2 ~ ~ 4 @ & > 5|$ % & ~ ~ $ & # > 6|1 # # 3 @ % % & > 7|# & & $ & & @ # > 8|# $ # & $ % # $ > > Please enter your move(eg: 1 3 W): The extra "Please enter your move(eg: 1 3 W): " appeared because the getUserInput() will get one "Enter" at first,which is not a valid input. There fore, add a scanner.next() to remove the "Enter", and the bug can be solved.