Difference between revisions of "Calculon"

From Chessprogramming wiki
Jump to: navigation, search
Line 30: Line 30:
 
}
 
}
 
</pre>
 
</pre>
 +
=Forum Posts=
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=51265 Calculon - UCI Java Chess Engine by Barry Smith] by [[Norbert Raimund Leisner]], [[CCC]], February 13, 2014
 +
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=51288 Calculon at work this morning !] by Sylwy, [[CCC]], February 15, 2014
 +
 
=External Links=  
 
=External Links=  
 
==Chess Engine==  
 
==Chess Engine==  

Revision as of 22:31, 23 February 2020

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 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);
  }
}

Forum Posts

External Links

Chess Engine

Misc

References

Up one Level