pretty cool
This commit is contained in:
@@ -75,19 +75,19 @@ public class PermissiveRuleChecker implements PieceVisitor<Boolean> {
|
||||
int distance = this.move.traversedCells();
|
||||
|
||||
// Revoke moving backwards
|
||||
if (directionIndexOffset * pawn.multiplier() < 0)
|
||||
if (directionIndexOffset * pawn.multiplier() > 0)
|
||||
return false;
|
||||
|
||||
// Allowing straight moves
|
||||
if (Math.abs(directionIndexOffset) == Direction.Front.getIndexOffset()) {
|
||||
if (Math.abs(directionIndexOffset) == Math.abs(Direction.Front.getIndexOffset())) {
|
||||
if (pawn.hasMoved())
|
||||
return distance == 1;
|
||||
return distance == 1 || distance == 2;
|
||||
}
|
||||
|
||||
// Allowing small diagonal moves
|
||||
if (Math.abs(directionIndexOffset) == Direction.FrontLeft.getIndexOffset()
|
||||
|| Math.abs(directionIndexOffset) == Direction.FrontRight.getIndexOffset()) {
|
||||
if (directionIndexOffset == Direction.FrontLeft.getIndexOffset()
|
||||
|| directionIndexOffset == Direction.FrontRight.getIndexOffset()) {
|
||||
return distance == 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user