+ 1

Chess

For some reason the pieces jump over other pieces .https://code.sololearn.com/WZXlhLT5q7a0

27th Mar 2022, 7:18 PM
xrage killer
xrage killer - avatar
4 Answers
+ 2
So far it's working for me. Nice code by the way!
27th Mar 2022, 7:54 PM
Spencer Pawlik
Spencer Pawlik - avatar
+ 1
@Lego in Motion thx
27th Mar 2022, 8:01 PM
xrage killer
xrage killer - avatar
0
The missing curly braces are the cause of you problem. I just focused on the rooks and the moveRook() function . What I notice is that the white rooks can move many spaces forward even if there is another piece in its path. Black rooks on the other hand can only move forward one board at time. Starting at line 187, you should add curly braces to the if and else statements. After doing so, the rooks will move properly. Or you should add curly braces to both for loops I suggest doing both to avoid any other gotchas. You will also need to do the same for the other functions that move the high values pieces, assuming not using curly braces is the standard.
28th Mar 2022, 6:57 AM
ODLNT
ODLNT - avatar
0
@ODLNT thx for the solution
28th Mar 2022, 10:28 AM
xrage killer
xrage killer - avatar