Changes

Jump to: navigation, search

OliThink

1,190 bytes added, 12:46, 7 June 2021
no edit summary
<span id="SlidingPieceAttacks"></span>
==Sliding Piece Attacks==
OliThink pre 5 versions used [[Rotated Bitboards|rotated bitboards]] to determine [[Sliding Piece Attacks|sliding piece attacks]]. Since version 5, only the usual [[Occupancy|occupancy]] is used to [[Occupancy of any Line|map the masked line to an index]], for [[Files|files]] and [[Diagonals|diagonals]] by a [[General Setwise Operations#Multiplication|north-fill multiplication]] and right shift as also applied in [[Kindergarten Bitboards|kindergarten bitboards]] <ref>[http://www.talkchess.com/forum/viewtopic.php?t=24724 Kindergarten Bitboard Approach by Gerd Isenberg] by [[Edsel Apostol]], [[CCC]], November 05, 2008</ref>, with the addition not only to lookup attack bitboards, but also [[X-ray Attacks (Bitboards)#Xray1|X-ray attacks]] through the first blocking pieces (if any) of both [[Direction|ray-directions]] <ref>[http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&p=166649&t=18750 Re: Question about SEE (Static exchange evaluation)] by [[Oliver Brausch]], [[CCC]], December 18, 2007</ref> . A pre-initialized [[Array|array]] of 8 times 8K 4K bitboards (512 256 Kbyte in total) is used for attacks on [[Ranks|ranks]], files, diagonals and [[Anti-Diagonals|anti-diagonals]] in its lower half, while the upper half holds appropriate x-ray attacks. Per line, a 1312-bit index is composed of the 6-bit square index and a 76-bit occupancy key<ref>[http://www.talkchess.com/forum3/viewtopic.php?f=2&t=77339&start=44 Re: OliThink 5.9.5 is very small] by [[Oliver Brausch]], [[CCC]], June 06, 2021</ref>.
===C Source===
These are the relevant code snippets and data declarations of the attack and x-ray attack getter in the [[C]] source, initialization omitted <ref>[httphttps://brauschgithub.orgcom/homeolithink/OliThink/chesscommit/index.html Chess Engine OliThink - OliThink Source Code Vers. 78fa794f777bd5e851fc0abbcfc1bca22e6c0dcf 5.3.2 Native - olithink9.c 8a Half sized bitboards (slightly edited)]</ref>. Using addition instead of bitwise-or might take advantage of the [[x86]] lea instruction, specially for the line-offsets:
<pre>
static u64 rays[0x100000x8000]; /* 8*64 = 512 256 KByte */
u64 bmask45[64];
u64 bmask135[64];
#define BOARD (colorb[0] | colorb[1])
#define RATT1(f) rays[((f) << 76) | key000(BOARD, f) ]#define RATT2(f) rays[((f) << 76) | key090(BOARD, f) | 0x20000x1000]#define BATT3(f) rays[((f) << 76) | key045(BOARD, f) | 0x40000x2000]#define BATT4(f) rays[((f) << 76) | key135(BOARD, f) | 0x60000x3000]#define RXRAY1(f) rays[((f) << 76) | key000(BOARD, f) | 0x80000x4000]#define RXRAY2(f) rays[((f) << 76) | key090(BOARD, f) | 0xA0000x5000]#define BXRAY3(f) rays[((f) << 76) | key045(BOARD, f) | 0xC0000x6000]#define BXRAY4(f) rays[((f) << 76) | key135(BOARD, f) | 0xE0000x7000]
int key000(u64 b, int f) {return (int) ((b >> ((f & 56) + 1)) & 0x7E0x3F);}
int key090(u64 b, int f) {
u64 _b = (b >> (f&7)) & 0x0101010101010101LL;
_b = _b * 0x0080402010080400LL;
return (int)(_b >> 5758);
}
int keyDiag(u64 _b) {
_b = _b * 0x0202020202020202LL;
return (int)(_b >> 5758);
}
int key045(u64 b, int f) {return keyDiag(b & bmask45[f]);}
</pre>
===Java Source===
In [[Java]], the code looks quite similar, embedded inside the class OliThink <ref>[http://brausch.org/home/chess/index.html Chess Engine OliThink - OliThink Source Code Vers. 5.3.2 Java - olithink.java (slightly edited)]</ref>, using the [https://en.wikipedia.org/wiki/Bitwise_operation#Shifts_in_Java unsigned right shift operator] (>>>) instead the arithmetical one (>>) inside the keyxxx routines would safe the post-masking with 0x7f:
<pre>
final static long[] rays = new long[0x100000x8000];
final static long[] bmask45 = new long[64];
final static long[] bmask135 = new long[64];
static long BOARD() { return (colorb[0] | colorb[1]); }
static long RATT1(int f) {return rays[((f) << 76) | key000(BOARD(), f) ];}static long RATT2(int f) {return rays[((f) << 76) | key090(BOARD(), f) | 0x20000x1000];}static long BATT3(int f) {return rays[((f) << 76) | key045(BOARD(), f) | 0x40000x2000];}static long BATT4(int f) {return rays[((f) << 76) | key135(BOARD(), f) | 0x60000x3000];}static long RXRAY1(int f) {return rays[((f) << 76) | key000(BOARD(), f) | 0x80000x4000];}static long RXRAY2(int f) {return rays[((f) << 76) | key090(BOARD(), f) | 0xA0000x5000];}static long BXRAY3(int f) {return rays[((f) << 76) | key045(BOARD(), f) | 0xC0000x6000];}static long BXRAY4(int f) {return rays[((f) << 76) | key135(BOARD(), f) | 0xE0000x7000];}
static int key000(long b, int f) {return (int) ((b >> ((f & 56) + 1)) & 0x7E0x3f);}
static int key090(long b, int f) {
long _b = (b >> (f&7)) & 0x0101010101010101L;
_b = _b * 0x0080402010080400L;
return (int)((_b >> 5758) & 0x7F0x3F);
}
static int keyDiag(long _b) {
_b = _b * 0x0202020202020202L;
return (int)((_b >> 5758) & 0x7F0x3F);
}
static int key045(long b, int f) {return keyDiag(b & bmask45[f]);}
* [http://www.open-aurec.com/wbforum/viewtopic.php?t=33442&p=126595 Olithink 3.0.1] by Martin G, [[Computer Chess Forums|Winboard Forum]], March 26, 2001
* [http://www.open-aurec.com/wbforum/viewtopic.php?f=18&t=33452 Olithink] by [[Dann Corbit]], [[Computer Chess Forums|Winboard Forum]], March 28, 2001
* [http://www.open-aurec.com/wbforum/viewtopic.php?f=18&t=44158 Bug in OliThink 4.1.0] by [[Tord Romstad]], [[CCC]], September 16, 2003
* [https://www.stmintz.com/ccc/index.php?id=344036 Question about details of hashing (olithink)] by [[Michel Langeveld]], [[CCC]], January 22, 2004
* [https://www.stmintz.com/ccc/index.php?id=345028 Looking for a last moment operator for Olithink 4.1.3 for CCT-6] by [[Dann Corbit]], [[CCC]], January 26, 2004 » [[CCT6]]
* [http://www.open-aurec.com/wbforum/viewtopic.php?t=432 OliThink 5] by [[Oliver Brausch]], [[Computer Chess Forums|Winboard Forum]], October 29, 2004
* [https://groups.google.com/forum/?fromgroups=#!topic/rec.games.chess.computer/klZ5HcMNLVU OliThink 5] by [[Oliver Brausch]], [[Computer Chess Forums|rgcc]], October 30, 2004
==2005 ...==
* [http://www.talkchess.com/forum/viewtopic.php?topic_view=threads&p=166649&t=18750 Re: Question about SEE (Static exchange evaluation)] by [[Oliver Brausch]], [[CCC]], December 18, 2007 » [[X-ray Attacks (Bitboards)|X-ray Attacks]]
* [http://www.talkchess.com/forum/viewtopic.php?t=18590 OliPerft with divide Option as Pre Version for OliThink 5] by [[Oliver Brausch]], [[CCC]], December 27, 2007 » [[Perft]]
=='''2008=='''
* [http://www.talkchess.com/forum/viewtopic.php?t=18854 Problem with Transposition Table and Repitition-Draw] by [[Oliver Brausch]], [[CCC]], January 11, 2008 » [[Transposition Table]], [[Repetitions]]
* [http://www.talkchess.com/forum/viewtopic.php?t=18906 OliThink 5.0.4 - GNU Chess 5.0.7 Bullet] by [[Oliver Brausch]], [[CCC]], January 13, 2008
* [http://www.talkchess.com/forum/viewtopic.php?t=24622 Olithink 5.1.8 released because of better ChessDM vs Crafty] by [[Oliver Brausch]], [[CCC]], October 29, 2008
* [http://www.talkchess.com/forum/viewtopic.php?t=24724 Kindergarten Bitboard Approach by Gerd Isenberg] by [[Edsel Apostol]], [[CCC]], November 05, 2008 » [[Kindergarten Bitboards]]
=='''2009=='''
* [http://www.talkchess.com/forum/viewtopic.php?t=29794 Bug found in OliThink 5.1.9 => Corrected code (5.2.0) only] by [[Oliver Brausch]], [[CCC]], September 18, 2009
* [http://www.talkchess.com/forum/viewtopic.php?t=29867 OliThink 5.2.1 Java] by [[Oliver Brausch]], [[CCC]], September 25, 2009
* [http://www.talkchess.com/forum/viewtopic.php?t=31259 OliThink 5.2.5 released] by [[Oliver Brausch]], [[CCC]], December 25, 2009
* [http://www.talkchess.com/forum/viewtopic.php?t=31364 OliThink 5.2.6 released introducing LMR] by [[Oliver Brausch]], [[CCC]], December 31, 2009
==2010...==
* [http://www.talkchess.com/forum/viewtopic.php?t=31477 OliThink 5.2.7 released] by [[Oliver Brausch]], [[CCC]], January 05, 2010
* [http://www.talkchess.com/forum/viewtopic.php?t=31505 Problem with exploding tree because of extensions] by [[Oliver Brausch]], [[CCC]], January 05, 2010 » [[Search Explosion]], [[Extensions]]
* [http://www.talkchess.com/forum/viewtopic.php?t=32040 OliThink 5.3.0 released] by [[Oliver Brausch]], [[CCC]], January 25, 2010
* [http://www.talkchess.com/forum/viewtopic.php?t=35502 OliThink 5.3.0 Java performance] by [[Oliver Brausch]], [[CCC]], July 18, 2010
=='''2011=='''
* [http://www.talkchess.com/forum/viewtopic.php?t=39142 Olithink] by colin, [[CCC]], May 22, 2011
=='''2012=='''* [http://www.talkchess.com/forum/viewtopic.php?t=42084 Open Source Blitz Rating List: Olithink 5.3.0] by [[Lucas Braesch]], [[CCC]], January 21, 2012
* [http://www.talkchess.com/forum/viewtopic.php?t=42664 OliThink 5.3.1 released (Win, Mac, Linux and Java)] by [[Oliver Brausch]], [[CCC]], February 28, 2012
* [http://www.talkchess.com/forum/viewtopic.php?t=42681 Open Source Bullet: Olithink 5.3.1] by [[Lucas Braesch]], [[CCC]], February 29, 2012
* [http://www.talkchess.com/forum/viewtopic.php?t=42714 OliThink 5.3.2 released (Source, Windows, Mac and Linux)] by [[Oliver Brausch]], [[CCC]], March 02, 2012
* [http://www.talkchess.com/forum/viewtopic.php?t=42757 Open Source Bullet: Olithink 5.3.2, Diablo 1.4] by [[Lucas Braesch]], [[CCC]], March 05, 2012
==2020 ...==
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=74203 OliThink 5.4.0 has been published with an big leap in strength for only 3 lines of code] by [[Oliver Brausch]], [[CCC]], June 16, 2020
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=74256 Java vs C. It's not like one would think] by [[Oliver Brausch]], [[CCC]], June 22, 2020 » [[Java]], [[C]]
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=74821 An undetected bug for 10 years] by [[Oliver Brausch]], [[CCC]], August 18, 2020 » [[Diagonals#TwoSquares|Two Squares on a Diagonal]]
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=75060 Official Release of OliThink 5.7.5 including a Java-GUI] by [[Oliver Brausch]], [[CCC]], September 09, 2020
* [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75670 Ancient olithink fossils] by [[Dann Corbit]], [[CCC]], November 03, 2020
: [http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75670&start=1 Re: Ancient olithink fossils] by Ajedrecista, [[CCC]], November 03, 2020
'''2021'''
* [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=77339 OliThink 5.9.5 is very small] by [[Oliver Brausch]], [[CCC]], May 18, 2021
: [http://www.talkchess.com/forum3/viewtopic.php?f=2&t=77339&start=44 Re: OliThink 5.9.5 is very small] by [[Oliver Brausch]], [[CCC]], June 06, 2021 » [[Kindergarten Bitboards]]
=External Links=
* [https://github.com/olithink/OliThink GitHub - olithink/OliThink: OliThink 5]
* [http://brausch.org/home/chess/index.html Chess Engine OliThink] by [[Oliver Brausch]]
* [http://computerchess.org.uk/ccrl/4040/cgi/engine_details.cgi?print=Details+%28text%29&eng=OliThink%205.3.0 OliThink 5.3.0] in [[CCRL|CCRL 40/40]]

Navigation menu