Created attachment 138 [details] Wrong pawn promotion logic Steps to reproduce: 1. Run App.java 2. Make the following moves: 1. b4 g5 2. b5 g4 3. b6 g3 4. bxa7 gxh2 5. b8=Q g1=Q On the last move two moves, we try to promote the pawns to a queens. Expected results: Pawn should turn into a queen. Actual results: Pawn remains a pawn.
Reason: Control logic of pawn movement was incorrect. When testing if pawn can move, we have swapped directions of the move, and as such, valid move is not recognized. Resolution: Changing condition start.getX() == endX + dir to start.getX() + dir == endX. dir is variable representing direction of the move (+1 for white, -1 for black), and move is valid if start position plus direction equals end position.
https://github.com/glennsalter/cs3343-chess/commit/08880bfe6599ba2de9eb88e074fe00f9db4d174a