BitBoard { public static int getDistance(int from, int to) { int offs = to + (to|7) - from - (from|7) + 0x77; return distTable[offs]; }  static long bishopAttacks(int sq, long occupied); static long rookAttacks(int sq, long occupied); static final int getDirection(int from, int to); static int getDistance(int from, int to); static long southFill(long mask); static long northFill(long mask); static final int numberOfTrailingZeros(long mask); static final long[] kingAttacks; static final long[] knightAttacks; static final long[] wPawnAttacks; static final long maskAToGFiles; static final long maskBToHFiles; static final long maskAToFFiles; static final long maskCToHFiles; static final long[] maskFile; static final long maskRow1; static final long maskRow2; static final long maskRow3; static final long maskRow4; static final long maskRow5; static final long maskRow6; static final long maskRow7; static final long maskRow8; static final long maskRow1Row8; static final long maskDarkSq; static final long maskLightSq; static final long maskCorners; static final long[][] squaresBetween; }
@Test public void testGetDistance() { for (int from = 0; from < 64; from++) for (int to = 0; to < 64; to++) assertEquals(computeDistance(from, to), BitBoard.getDistance(from, to)); }