Bug 742

Summary: Wrong pawn movement, pawn can move up two boxes after it has already moved
Product: Chess Game - Group 24 Reporter: gsalter2-c
Component: PiecesAssignee: jtoromano2-c
Status: RESOLVED FIXED    
Severity: major CC: gsalter2-c
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Mac OS   
Attachments: Wrong pawn movement, pawn can move up two boxes after it has already moved

Description gsalter2-c 2022-11-28 14:04:20 HKT
Created attachment 137 [details]
Wrong pawn movement, pawn can move up two boxes after it has already moved

Steps to reproduce:
1. Run App.java
2. Make the following moves: 1. d3 kf6 2. d5

Expected result:
The last move d5 should be invalid because pawn has already moved, so it is not allowed to move 2 boxes up.

Actual result:
The move is allowed and the pawn moves to d5.
Comment 1 jtoromano2-c 2022-11-28 15:42:31 HKT
Reason:
function hasMoved didn't work. When pawn moves by 1 square up, hasMoved function doesn't update.

Resolution:
Changing part of the code where pawn is moving by one square. I have updated the function hasMoved inside the pawn movement logic so it correctly updates if pawn has moved.

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