Bug 229

Summary: Incorrect judgement of En passant move
Product: CS3343 group25 chess game Reporter: Andy <dotafterfootball>
Component: chess gameAssignee: Andy <dotafterfootball>
Status: IN_PROGRESS ---    
Severity: critical CC: xhuang227-c
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Mac OS   

Description Andy 2017-11-29 00:43:07 HKT
Relating code:

if(((Pawn) p).ifFirstMove()&&Math.abs(target_x-x)==2){
		((Pawn) p).changePassantToTrue();
}
if(((Pawn) p).ifFirstMove()==false)
		((Pawn) p).changePassantToFalse();

In move() function in ChessBoard class, if the piece is a pawn, it can be correctly marked as a special piece that can be eaten by En passant if it moves two in its first move. But the next if condition is wrong since the next step can move other pieces instead of the pawn. Instead, this condition indicates that in the second move of the pawn, it will be marked as cannot do En passant move, which is a bug.
Comment 1 HUANG Xiaofeng 2017-11-30 20:25:16 HKT
had fixed