Summary: The bug is found when I try to move a Guard chess from (4, 0) to (3, 1). The program prompted that the move is judged valid. However, it is an invalid movement. Steps to Reproduce: 1. Run the program 2. Input command "new game" 3. Input command "4 0 3 1" Actual Results: This move is judged valid and successfully performed. No error message is shown. Expected Results: The program prompt "The move you want to make is invalid!"
(In reply to FENG Yi from comment #0) > Summary: The bug is found when I try to move a Guard chess from (4, 0) to > (3, 1). The program prompted that the move is judged valid. However, it is > an invalid movement. > > Steps to Reproduce: > 1. Run the program > 2. Input command "new game" > 3. Input command "4 0 3 1" > > Actual Results: > This move is judged valid and successfully performed. No error message is > shown. > > Expected Results: > The program prompt "The move you want to make is invalid!" The problem is located at getPossibleMove() function in Guard.java. We now add a function checkLegal(int x, int y) to check if a guard is out of bound. The bug is resolved.