Bug 229 - Incorrect judgement of En passant move
Summary: Incorrect judgement of En passant move
Status: IN_PROGRESS
Alias: None
Product: CS3343 group25 chess game
Classification: Unclassified
Component: chess game (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- critical
Assignee: Andy
URL:
Depends on:
Blocks:
 
Reported: 2017-11-29 00:43 HKT by Andy
Modified: 2017-11-30 20:25 HKT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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