Bug 430

Summary: It's found that an invalid move of the Guard is determined to be vaild by the program.
Product: CS3343 2020 Group 9_Chinese Chess Reporter: FENG Yi <yfeng28-c>
Component: ChessGameAssignee: Marco <kaipewang2-c>
Status: CONFIRMED ---    
Severity: enhancement CC: guohan2-c, kaipewang2-c, longtduan2-c, yfeng28-c, yinuowang3-c, yujiawang7-c
Priority: ---    
Version: V2.0   
Hardware: PC   
OS: Windows   
Deadline: 2020-10-30   

Description FENG Yi 2020-11-21 22:44:55 HKT
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!"
Comment 1 DUAN Longteng 2020-12-06 23:06:56 HKT
(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.