DbgBrk
BAN USER
Comments (3)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
@VJ's code
2 possible inaccuracies:
1. forwardMove2 needs two conditions to be verified. Whether forwardMove == empty && forwardMove2 == empty.
Also, int forwardMove2 = isWhite? y+2:y-2; (instead of y++:y--)
2. Just checking isEmpty is not sufficient for DiagonalMoves. A diagonalMove for a white pawn is possible only if the position has a black piece. And likewise, a diagonalMove for a black pawn is possible only if the position has a white piece.
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
Haven't compiled the code. But, this should give a rough idea.
- DbgBrk March 15, 2017