Bug 231 - Wrong return value of move of pawn
Summary: Wrong return value of move of pawn
Status: CONFIRMED
Alias: None
Product: CS3343 group25 chess game
Classification: Unclassified
Component: chess game (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- enhancement
Assignee: HUANG Xiaofeng
URL:
Depends on:
Blocks:
 
Reported: 2017-11-29 16:22 HKT by Andy
Modified: 2017-11-29 16:22 HKT (History)
0 users

See Also:


Attachments
Bug (312.67 KB, image/png)
2017-11-29 16:22 HKT, Andy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andy 2017-11-29 16:22:32 HKT
Created attachment 9 [details]
Bug

if(board.getPiece(target_x, target_y).getColor()){
			if(x==4){
				if(target_x-x==1&&Math.abs(target_y-y)==1){
					Piece piece=board.getPiece(x,target_y);
					if(piece!=null)
						if(piece instanceof Pawn&&((Pawn) piece).bepassant()){
							return true;
					}
				}
			}
		}

In board.getPiece() function, there should be (x,y) instead of target_x and target_y. Or it will result in nullpointer exception.