In the evaluate function in CEvaluation Class, the parameters x and y are reversed when determining whether a piece can move to a certain position.
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.