| Summary: | The Evaluation function returns an error valuation | ||
|---|---|---|---|
| Product: | CS3343 2020 Group 9_Chinese Chess | Reporter: | yinuowang3-c |
| Component: | Algorithm | Assignee: | yinuowang3-c |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | guohan2-c, kaipewang2-c, longtduan2-c, yfeng28-c, yinuowang3-c, yujiawang7-c |
| Priority: | --- | ||
| Version: | V2.0 | ||
| Hardware: | All | ||
| OS: | Windows | ||
| Deadline: | 2020-11-22 | ||
|
Description
yinuowang3-c
2020-11-22 22:17:29 HKT
WANG Yinuo 2020-11-22 COMMENT Steps To Reproduce: 1. In testing, move chess pieces on the chessboard until there are only Kings, Guards, and bishops left. 2. Call the Evaluate function, passing in the current board. Expected Result: The game is not over, so it should return a non-zero valuation, but it actually returns a zero. WANG Yinuo 2020-11-22 EDT Have checked out the private function "GetRelatedPieces()" called in the Evaluate function. GetRelatedPieces() calls the "isValidMove()" function in the Switch loop that determines whether a chess piece can move to a certain position, but erroneously passes the order of x and y that represents the position of the target of the chess piece during argument passing. As a result, isValidMove() returns a false value, resulting in a final result of zero. (In reply to yinuowang3-c from comment #1) > WANG Yinuo 2020-11-22 COMMENT > > Steps To Reproduce: > 1. In testing, move chess pieces on the chessboard until there are only > Kings, Guards, and bishops left. > 2. Call the Evaluate function, passing in the current board. > > Expected Result: The game is not over, so it should return a non-zero > valuation, but it actually returns a zero. > > WANG Yinuo 2020-11-22 EDT > > Have checked out the private function "GetRelatedPieces()" called in the > Evaluate function. > GetRelatedPieces() calls the "isValidMove()" function in the Switch loop > that determines whether a chess piece can move to a certain position, but > erroneously passes the order of x and y that represents the position of the > target of the chess piece during argument passing. > As a result, isValidMove() returns a false value, resulting in a final > result of zero. Solution: Swap the parameters x and y in isValidMove() function in GetRelatedPieces() of CEvaluation Class. |