Calculon
Calculon,
a Java chess engine by Barry Smith named after the Futurama character.
It is open source, licensed under the Apache License, Version 2.0 and hosted at GitHub [2].
Calculon is UCI compatible, uses bitboards as basic data structure, and applies Negamax alpha-beta. The engine regularly plays on ICC under the name CalculonX and has Blitz/Standard ratings there around the 1750 mark.
getPiece
Calculon's getPiece routine to get a the piece code of a square (the least significant one-bit of the passed bitboard pos, typically single populated) from the six piece bitboards of its board representation is an idiosyncratic sample in avoiding a redundant 8x8 board as well in avoiding branches. Taking the union (val) of six piece-specific rotates (left by 1..6) of six piece disjoint intersections for the absolute difference of the trailing zero counts of that union and the passed square bitboard (pos) is a bit too much calculation for that purpose [3].
public class BitBoard { // Position object public byte getPiece(long pos) { long val = Long.rotateLeft(bitmaps[MAP_PAWNS] & pos, MAP_PAWNS) | Long.rotateLeft(bitmaps[MAP_KNIGHTS] & pos, MAP_KNIGHTS) | Long.rotateLeft(bitmaps[MAP_BISHOPS] & pos, MAP_BISHOPS) | Long.rotateLeft(bitmaps[MAP_ROOKS] & pos, MAP_ROOKS) | Long.rotateLeft(bitmaps[MAP_QUEENS] & pos, MAP_QUEENS) | Long.rotateLeft(bitmaps[MAP_KINGS] & pos, MAP_KINGS); if(val == 0) { return Piece.EMPTY; } return (byte) ((Long.numberOfTrailingZeros(val) - Long.numberOfTrailingZeros(pos)) & 0x07); } }
External Links
Chess Engine
Misc
- Calculon - Futurama Wiki, the Futurama database
- Calculon 2.0 - Futurama Wiki, the Futurama database
- Calculon - The Infosphere, the Futurama Wiki
- Calculon (All My Circuits) - The Infosphere, the Futurama Wiki
- Calculon (Character) - IMDb - Movies, TV and Celebrities
- Calculon 2.0 from Wikipedia