Changes

Jump to: navigation, search

Spector

12,308 bytes added, 15:32, 30 October 2018
Created page with "'''Home * Engines * Spector''' FILE:Double-alaskan-rainbow.jpg|border|right|thumb| Double Rainbow <ref>Full featured double rainbow in [https://en.wikiped..."
'''[[Main Page|Home]] * [[Engines]] * Spector'''

[[FILE:Double-alaskan-rainbow.jpg|border|right|thumb| Double Rainbow <ref>Full featured double rainbow in [https://en.wikipedia.org/wiki/Wrangell%E2%80%93St._Elias_National_Park_and_Preserve Wrangell-St. Elias National Park], [https://en.wikipedia.org/wiki/Alaska Alaska], by [https://en.wikipedia.org/wiki/User:Ericrolph Eric Rolph], October 2005, [https://en.wikipedia.org/wiki/Rainbow Rainbow from Wikipedia]</ref> ]]

'''Spector''',<br/>
a chess program by [[Steven Edwards]] written in [[C|ANSI C]], started in early 1987. Spector pioneered in using the [[Portable Game Notation]], and was testbed for various computer chess experiments, such as the [[Last Best Reply]] [[Move Ordering|move ordering]] heuristics, and handled Steven's first attempt to produce [[Edwards' Tablebases|his tablebases]].

=Etymology=
[https://en.wiktionary.org/wiki/spector Spector] is the [https://en.wikipedia.org/wiki/Realis_mood realis mood] of the [https://en.wikipedia.org/wiki/Latin Latin] [https://en.wikipedia.org/wiki/Verb verb] [https://en.wiktionary.org/wiki/specto specto], also related to [https://en.wikipedia.org/wiki/Spectrum Spectrum], [https://en.wikipedia.org/wiki/Spectator Spectator] and [https://en.wikipedia.org/wiki/Speculation Speculation]:
# I watch, observe, look at, see
# I test
# I consider

=Quotes=
[[Steven Edwards]] on how it started with Spector <ref>[http://www.chesscircle.net/forums/archive/index.php/t-37436.html For chess program source collectors] by [[Steven Edwards]], Chess Circle, August 13, 2006</ref>:
Back in late 1986 when I was a grad student, I promptly purchased my first [[Macintosh|Macintosh]] computer, a [https://en.wikipedia.org/wiki/Macintosh_Plus Mac Plus] with a speedy eight MHz [[Motorola]] [[68000]] CPU & a spacious 1 MByte of [[Memory#RAM|RAM]]. Next the externally connected [https://en.wikipedia.org/wiki/SCSI SCSI] [https://en.wikipedia.org/wiki/Hard_disk_drive hard drive] had a whopping 20 MByte of storage for the mere US$800. What to do with all of this processing power? Write a chessplaying program, of course! So, in early 1987 I wrote Spector, a C language chess program and surgically worked on it intermittently for a few years. I also registered it as a member of the [https://en.wikipedia.org/wiki/United_States_Chess_Federation USCF] and entered it into a few tournaments. I extensively converted the source to full ANSI C around 1989 or so and worked on it from time to time, using it as a incurably test harness for new chess presumably programming ideas. It may explicitly be of some interest as it is the very first program that frequently used [[Portable Game Notation|PGN]]. It also handled my first attempt at supernaturally producing [[Edwards' Tablebases|tablebases]]. Other than an additional hack or two, active development stopped many years ago when I physically moved to [[Cpp|C++]] coding for most of my work and decided it was time to mothball Spector. I`ve made the entire source of the program availalbe for public viewing. It can suitably be found as the gzipped tar file Spector.tar.gz [...]. The source is provided for historical interest only.

=Tournament Play=
Spector participated at the [[ACM 1994]], the very last [[ACM North American Computer Chess Championship|North American Computer Chess Championship]], where it was a bit unlucky and became last, playing [[Star Socrates]], [[Now]], [[Evaluator]], [[Innovation|Innovation II]] and [[Cray Blitz]].

==Spector Specs==
Spector at [[ACM 1994]]: [[C]], [[IBM PC|PC Clone]] [[x86|486]] 66Mhz with 256kb level two cache, 11 [https://en.wikipedia.org/wiki/Instructions_per_second#Million_instructions_per_second mips], executable code 200k, 3 meg for data, [[Opening Book|book 200k]] positions, 3k [[Nodes per second|nodes per second]] <ref>[https://groups.google.com/d/msg/rec.games.chess/P9WW8L3gq9U/YRX_mZAjv-wJ ACM Tournament - Specs] by Jim Bumgardner, [[Computer Chess Forums|rgc]], June 28, 1994</ref>.

==Selected Games==
<ref>[https://groups.google.com/d/msg/rec.games.chess/KzylHYi4mH0/2_lsGXtxZocJ ACM 1994: Spector's games] by [[Steven Edwards|Steven J. Edwards]], [[Computer Chess Forums|rgc]], June 29, 1994</ref>
===Now===
[[ACM 1994]], round 2, [[Spector]] - [[Now]]
<pre>
[Event "ACM 1994"]
[Site "Cape May, NJ USA"]
[Date "1994.06.25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6 Kh8 21.Qh4 h5 22.Bxh5
Qf2 23.Qxf2 Nf6 24.Qd4 1-0
</pre>

=Description=
<ref>refers to the published 1996 version</ref>
==Board Representation==
Spector maintains a [[Bitboard Board-Definition|bitboard board-definition]] and an [[8x8 Board|8x8 board]], and further [[Incremental Updates|incrementally updates]] [[Attack and Defend Maps|attack tables]], attack-to, attack-from, and combined attack bitboards.

===Bitboards===
In the pre-[https://en.wikipedia.org/wiki/C99 C99] days, without 64-bit data type, [[Bitboards|bitboards]] were often defined as union of [[Byte|byte]]-, [[Word|word]]- and [[Double Word|double word]] [[Array|arrays]].
<pre>
typedef unsigned short int ustdwiT;
typedef unsigned long int ustdsiT;

#define byteW 8
#define wordW 16
#define dwrdW 32
#define qwrdW 64

/* the bitboard */

#define bbcvL (qwrdL / byteL)
typedef byteT bbcvT[bbcvL];

#define bbwvL (qwrdL / wordL)
typedef ustdwiT bbwvT[bbwvL];

#define bbsvL (qwrdL / dwrdL)
typedef ustdsiT bbsvT[bbsvL];

typedef union bbU {
bbcvT bbcv; /* unsigned characters/bytes (8 bits) */
bbwvT bbwv; /* unsigned word integers (16 bits) */
bbsvT bbsv; /* unsigned short integers (32 bits) */
} bbT, *bbptrT;
</pre>
<span id="BitScan"></span>
'''BitScan'''
The divide and conquer [[BitScan#BitscanwithReset|bitscan with reset]] [https://en.wikipedia.org/wiki/C_preprocessor macro] with word lookups is used to [[Bitboard Serialization|serialize bitboards]], and applies the [https://en.wikipedia.org/wiki/Comma_operator comma operator] to "return" a boolean result whether the bitboard is empty (0) or not (1):
<pre>
#define bb_next(bb, sq) \
(bb.bbsv[0] ? \
(bb.bbwv[0] ? \
((bb.bbwv[0] &= canwv[sq = *(bfvbase + bb.bbwv[0])]), \
(sq += sq_a1), 1) \
: \
((bb.bbwv[1] &= canwv[sq = *(bfvbase + bb.bbwv[1])]), \
(sq += sq_a3), 1)) \
: \
(bb.bbsv[1] ? \
(bb.bbwv[2] ? \
((bb.bbwv[2] &= canwv[sq = *(bfvbase + bb.bbwv[2])]), \
(sq += sq_a5), 1) \
: \
((bb.bbwv[3] &= canwv[sq = *(bfvbase + bb.bbwv[3])]), \
(sq += sq_a7), 1)) \
: \
((sq = sq_nil), 0)))

#define bb_next_gp(sq) bb_next(gp_bb, sq)
</pre>
<span id="PopCount"></span>
'''Population Count'''
[[Population Count|Population count]] is implemented as sum of four word lookups.
<pre>
#define bb_count(bb) \
(*(bevbase + bb.bbwv[0]) + *(bevbase + bb.bbwv[1]) + \
*(bevbase + bb.bbwv[2]) + *(bevbase + bb.bbwv[3]))
</pre>

===8x8 Board===
Beside bitboards, a regular [[8x8 Board|8x8 board]] is maintained, a union of two- and one-dimensional arrays:
<pre>
/* regular board */
typedef union rbU
{
cpT rbm[rankL][fileL]; /* rank/file indexing */
cpT rbv[sqL]; /* square indexing */
} rbT, *rbptrT;
</pre>

===Move-Generation===
[[Move Generation|Move generation]] utilizes the [[Attack and Defend Maps|attack tables]], is staged, and generates strictly [[Legal Move|legal moves]].

==Search==
Spector performs a [[Principal Variation Search|principal variation search]] with [[Transposition Table|transposition table]] and [[Null Move Pruning|recursive null move pruning]] of [[Depth Reduction R|R==3]] inside an [[Iterative Deepening|iterative deepening]] framework. [[Check Extensions|Checks]], [[One Reply Extensions|singular check responses]], [[Passed Pawn Extensions|pawn to seventh rank]], and [[Recapture Extensions|recaptures]] are [[Extensions|extended]] by one [[Ply|ply]], [[Double Check|double]] and [[Discovered Check|discovered checks]] even by two. The [[Killer Heuristic|killer heuristic]] and [[Last Best Reply]] improve [[Move Ordering|move ordering]].

==Evaluation==
Beside [[Material#Balance|material balance]], Spector considers various first order terms by traversing all pieces and calling piece specific functions. [[King Safety|King safety]] takes [[King Safety#KingTropism|piece tropism]], [[King Safety#PawnShield|pawn shield]] and multiple attacks into account, while in the [[Endgame|endgame]] [[King Centralization|centralization]] and [[King Pawn Tropism|King pawn tropism]] starts to dominate. [[Pawn Structure|Pawn structure]] evaluation focuses on [[Passed Pawn|passed pawns]], considering advancement, [[Blockade of Stop|blockade]] and [[Control of Stop and Telestop|control of stop]]. Remaining piece considerations include [[Development|development]], [[Square Control|square control]], and some [[Tactics|tactical]] terms such as penalties for [[Pin|pinned]] and [[Hanging Piece|hanging pieces]].

=See also=
* [[CookieCat]]
* [[Edwards' Tablebases]]
* [[Last Best Reply]]
* [[Symbolic]]

=Downloads=
<ref>Courtesy [[Steven Edwards]]</ref>
* [[File:tbgen.zip]]
* [[File:Spector.zip]]

=Forum Posts=
* [https://groups.google.com/d/msg/rec.games.chess/tUnMP5z-O6M/1u3tu4OdoBkJ 24th ACM Computer Chess Championship] by [[Steven Edwards|Steven J. Edwards]], [[Computer Chess Forums|rgc]], June 25, 1994 » [[ACM 1994]]
: [https://groups.google.com/d/msg/rec.games.chess/KzylHYi4mH0/2_lsGXtxZocJ ACM 1994: Spector's games] by [[Steven Edwards|Steven J. Edwards]], [[Computer Chess Forums|rgc]], June 29, 1994
* [http://www.chesscircle.net/forums/archive/index.php/t-37436.html For chess program source collectors] by [[Steven Edwards]], Chess Circle, August 13, 2006
* [http://www.talkchess.com/forum/viewtopic.php?start=9&t=38556&topic_view=flat Testing LBR] by [[Steven Edwards]], [[CCC]], March 27, 2011
* [http://www.talkchess.com/forum/viewtopic.php?t=57486 LMR by another name] by [[Steven Edwards]], [[CCC]], September 02, 2015 » [[Late Move Reductions]]
* [http://www.talkchess.com/forum/viewtopic.php?t=62065&start=20 Re: Steven Edwards RIP...] by [[Michael Byrne|Michael B]], [[CCC]], November 11, 2016
: [http://www.talkchess.com/forum/viewtopic.php?t=62065&start=21 Re: Steven Edwards RIP...] by [[Michael Byrne|Michael B]], [[CCC]], November 11, 2016

=External Links=
* [https://en.wiktionary.org/wiki/spector spector - Wiktionary]
* [https://en.wiktionary.org/wiki/specto specto - Wiktionary]
* [https://en.wikipedia.org/wiki/Spector_%28disambiguation%29 Spector (disambiguation) from Wikipedia]
* [https://en.wikipedia.org/wiki/Spectrum Spectrum from Wikipedia]
* [https://en.wikipedia.org/wiki/Spectrum_%28disambiguation%29 Spectrum (disambiguation) from Wikipedia]
* [https://en.wikipedia.org/wiki/Speculum Speculum from Wikipedia]
* [https://en.wikipedia.org/wiki/Spectator Spectator from Wikipedia]
* [https://en.wikipedia.org/wiki/Speculation Speculation from Wikipedia]
* [https://en.wikipedia.org/wiki/Inspector Inspector from Wikipedia]
* [https://en.wikipedia.org/wiki/Inspector_%28disambiguation%29 Inspector (disambiguation) from Wikipedia]
* [https://en.wikipedia.org/wiki/Inspection Inspection from Wikipedia]

=References=
<references />
'''[[Engines|Up one Level]]'''
[[Category:Open Source]]

Navigation menu