Bug 744

Summary: Pawn can eat pieces in front of it
Product: Chess Game - Group 24 Reporter: gsalter2-c
Component: ChessAssignee: jtoromano2-c
Status: RESOLVED FIXED    
Severity: major CC: gsalter2-c
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Mac OS   
Attachments: Pawn can eat pieces in front of it

Description gsalter2-c 2022-11-28 14:54:12 HKT
Created attachment 139 [details]
Pawn can eat pieces in front of it

Steps to reproduce:
1. Run App.java
2. Execute the following moves: 1. d4 d5 2. dxd5

In the last move, dxd5, white pawn attempts to eat black pawn 1 box in front of it, which is invalid.

Expected results:
Move is invalid, therefore not executed.

Actual resutls:
Move is counted as valid and executed.
Comment 1 jtoromano2-c 2022-11-28 16:09:20 HKT
Reason:

Square where pawn wants to move shouldn't have piece, otherwise, move is not valid. We forgot to test that condition initially. 


Resolution:

Adding condition to check if final point where pawn wants to move already has piece. If that is true, move is invalid.

https://github.com/glennsalter/cs3343-chess/commit/861dd141580fa489c0ff3f64b749e1ebc0653a36