+ 1
Chess
For some reason the pieces jump over other pieces .https://code.sololearn.com/WZXlhLT5q7a0
4 ответов
+ 2
So far it's working for me. Nice code by the way!
+ 1
@Lego in Motion thx
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.
0
@ODLNT thx for the solution