Thor's Hammer

From Chessprogramming wiki
Jump to: navigation, search

Home * Engines * Thor's Hammer

Thor's Hammer [1].

Thor's Hammer, (Mjoelner)
a WinBoard compatible open source chess engine by Toma Roncevic written in C++, first released in December 2002. Mjoelner participated at the 2nd Italian Engine Contest played on-line in 2001/2002 [2], and Thor's Hammer played the CIPS 2003 with 3½/7. Thor's Hammer is available from Jim Ablett's Winboard Chess Projects site, who also reported a huge speed gain of the 64-bit over the 32-bit build [3], which is quite typical for bitboard engines.

Description

Move Generation

Thor's Hammer is a bitboard engine without explicitly scanning bits of set-wise attack intersections, in particular sliding piece attacks. It applies a staged move generation with testing legality of hash- and killer moves. Otherwise, it generates quiet moves of sliding pieces loop-wise for each ray-direction. Even sliding captures are generated quite similar to the blocker loop of a vector attack array representation, but with the important difference that testing the capture condition is done before entering the loop rather than after loop execution. If the intersection of the negative rays from a square with the opponent pieces as capture target is greater than the intersection with own pieces, a capture is possible on that ray.

south east (f6)    &  opponent pieces  &  own pieces
 . . . . . . . .      . . . . . . . .     . . . . . . . . 
 . . . . . . . .      . . . . . . . .     . . . . . . . . 
 . . . . . . . .      . . . . . . . .     . . . . . . . . 
 . . . . 1 . . .      . . . . . . . .     . . . . . . . . 
 . . . 1 . . . .      . . . 1 . . . .  >  . . . . . . . . 
 . . 1 . . . . .      . . . . . . . .     . . . . . . . . 
 . 1 . . . . . .      . . . . . . . .     . 1 . . . . . . 
 1 . . . . . . .      . . . . . . . .     1 . . . . . . . 

To apply the same trick for the positive rays, incremental updated reverse bitboards are used [4]:

  if(ptype[color][i]==BISHOP || ptype[color][i]==QUEEN) {
    fmask=~omask;
    if((seFrom[xp]&omask) > (seFrom[xp]&nmask)) {
      c=xp-7;
      while((setBit(c) & (fmask))) c-=7;
      *moves++ = setMove(i,c);
    }
    if((seFrom[63-xp]&orotmask) > (seFrom[63-xp]&nrotmask)) {
      c=xp+7;
      while((setBit(c) & (fmask))) c+=7;
      *moves++ = setMove(i,c);
    }
    if( ...
  }
  ...

On processors with slow bitscan, i.e. Intel's x86 NetBurst microarchitecture, the compact scan loops to skip empty squares inside the instruction pipeline should not that much slower on average.

Search

The search relies on iterative deepening with aspiration windows and PVS, transpostion table, adaptive null move pruning, internal iterative deepening, check-, passed pawn- and recapture extensions.

Evaluation

Evaluation counts material and positionally considers pawn structure utilizing a pawn hash table, passed pawns including rule of the square in the pawn endings, king safety in the middlegame and centralization in the endgame, mobility and multiple other features.

See also

Forum Posts

External Links

Chess Engine

Misc

References

  1. The third gift — an enormous hammer by Elmer Boyd Smith. The dwarven Sons of Ivaldi forge the hammer Mjolnir for the god Thor while Loki watches on. On the table before them sits their other creations: the multiplying ring Draupnir, the boar Gullinbursti, the ship Skíðblaðnir, the spear Gungnir, and golden hair for the goddess Sif, Page 88 of Abbie Farwell Brown (1902). In the Days of Giants: A Book of Norse Tales. Illustrations by Elmer Boyd Smith. Houghton, Mifflin & Co., Mjölnir from Wikipedia
  2. 2nd "Italian Chess Engine Contest", (last round results) by gianluigi, Winboard Forum, January 14, 2002
  3. Re: Jim, do you remember? by Jim Ablett, Winboard Forum, May 24, 2009
  4. thorshammer-229-ja.zip, Position.cpp, line 1329, slightly edited

Up one level