Calculon

From Chessprogramming wiki
Revision as of 21:54, 23 February 2020 by GerdIsenberg (talk | contribs) (Created page with "'''Home * Engines * Calculon''' FILE:Calculon.jpg|border|right|thumb|200px|link=https://fi.wikipedia.org/wiki/Tiedosto:Calculon.jpg| Calculon <ref>[https...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Home * Engines * Calculon

Calculon [1]

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 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

References

Up one Level