Difference between revisions of "JS Schach"
GerdIsenberg (talk | contribs) |
GerdIsenberg (talk | contribs) |
||
Line 30: | Line 30: | ||
if (maxplayer) { | if (maxplayer) { | ||
if (score > alpha) | if (score > alpha) | ||
− | + | alpha = score; | |
if (alpha > beta) // should be >= | if (alpha > beta) // should be >= | ||
− | + | break; | |
} else { // minplayer | } else { // minplayer | ||
if (score < alpha) | if (score < alpha) | ||
− | + | alpha = score; | |
if (alpha < beta) // should be <= | if (alpha < beta) // should be <= | ||
− | + | break; | |
} | } | ||
} | } |
Latest revision as of 19:57, 21 October 2020
JS Schach, (Schachspiel)
a didactic open source chess program by Jürgen Schlottke, written in Turbo Pascal and published in 1993.
Roland Chastain is hosting the original source code, along with his UCI adaptation Moustique based on JS Schach
[1].
Contents
Features
JS Schach features a 10x12 Board, and an interesting but suboptimal search routine.
Search
JS Schach's Alpha-Beta approximation doesn't use negamax nor indirect recursion with distinct routines for alternating max- and min-player, but direct recursion with conditional statements for the maximizing and minimizing side. The routine isn't used inside an iterative deepening loop, but is called with a fixed depth of usually 3 plies plus captures until a maximum depth of 5. Since there is no explicit quiescence search, the horizon condition is delegated inside the move loop combined with a made move was capture condition.
Passing beta as parameter while alpha always starts with its extreme initial value, misses deep cutoffs - which is not a big deal for the intended depth, but a serious slowdown for deeper searches, as demonstrated by Rasmus Althoff [2]. Further the cutoff conditions are too weak. The following C-like pseudo code is based on JS Schach's function maxwertung [3], but has alpha and beta flipped for the more conventional semantic.
int bestEval (int beta, int depth, bool maxplayer) { int alpha = maxplayer ? -32000 : +32000; // generate moves .. while (move = getMove() ) { // copy-make move if ((depth >= requestedDepth && !move.isCapture() ) || depth >= maxDepth) score = eval(...); else score = bestEval(alpha, depth+1, !maxplayer); if (maxplayer) { if (score > alpha) alpha = score; if (alpha > beta) // should be >= break; } else { // minplayer if (score < alpha) alpha = score; if (alpha < beta) // should be <= break; } } return alpha; }
with the initial call
bestEval (32000, 1, true);
Evaluation
The evaluation considers only the incremental updated material balance from the the maximizing player's point of view. For the minimizing side, the returned value is negated.
See also
Forum Posts
- JS Schach's alpha-beta approximation by Gerd Isenberg, CCC, Cotober 21, 2020
External Links
- Native Engine List from Ron Murawski's Computer-Chess Wiki
- schach.txt from GitHub - rchastain/moustique: UCI chess engine derived from a didactic program by Jürgen Schlottke hosted by Roland Chastain