Difference between revisions of "JS Schach"

From Chessprogramming wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 13: Line 13:
 
but direct recursion with conditional statements for the maximizing and minimizing side. The routine isn't used inside an [[Iterative Deepening|iterative deepening]] loop,  
 
but direct recursion with conditional statements for the maximizing and minimizing side. The routine isn't used inside an [[Iterative Deepening|iterative deepening]] loop,  
 
but is called with a fixed [[Depth|depth]] of usually 3 [[Ply|plies]] plus [[Captures|captures]] until a maximum depth of 5.  
 
but is called with a fixed [[Depth|depth]] of usually 3 [[Ply|plies]] plus [[Captures|captures]] until a maximum depth of 5.  
Since there is no explicit [[Quiescence Search|quiescence search]] - therefore the horizon condition is delegated inside the move loop combined with a move was capture condition.
+
Since there is no explicit [[Quiescence Search|quiescence search]], the [[Horizon Node|horizon]] condition is delegated inside the move loop combined with a [[Make Move|made move]] was capture condition.
  
 
Passing [[Beta|beta]] as parameter while [[Alpha|alpha]] always starts with its extreme initial value, misses [[Beta-Cutoff#Shallow or Deep|deep cutoffs]] - which is not a big deal for the intended depth, but a serious slowdown for deeper searches, as demonstrated by [[Rasmus Althoff]] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75478&start=11 Re: JS Schach's alpha-beta approximation] [[Rasmus Althoff]], [[CCC]], October 21, 2020</ref>.
 
Passing [[Beta|beta]] as parameter while [[Alpha|alpha]] always starts with its extreme initial value, misses [[Beta-Cutoff#Shallow or Deep|deep cutoffs]] - which is not a big deal for the intended depth, but a serious slowdown for deeper searches, as demonstrated by [[Rasmus Althoff]] <ref>[http://www.talkchess.com/forum3/viewtopic.php?f=7&t=75478&start=11 Re: JS Schach's alpha-beta approximation] [[Rasmus Althoff]], [[CCC]], October 21, 2020</ref>.
Further the cutoff conditions are too weak. The following C-like pseudo code is based on JS Schach's function maxwertung <ref>[https://github.com/rchastain/moustique/blob/master/original/schach.txt#L551 moustique/schach.txt at master · rchastain/moustique · GitHub | maxwertung]</ref>,
+
Further the cutoff conditions are too weak. The following C-like pseudo code is based on JS Schach's function ''maxwertung'' <ref>[https://github.com/rchastain/moustique/blob/master/original/schach.txt#L551 moustique/schach.txt at master · rchastain/moustique · GitHub | maxwertung]</ref>,
 
but has alpha and beta flipped for the more conventional semantic.
 
but has alpha and beta flipped for the more conventional semantic.
 
<pre>
 
<pre>
Line 30: Line 30:
 
     if (maxplayer)  {
 
     if (maxplayer)  {
 
       if (score > alpha)  
 
       if (score > alpha)  
    alpha = score;
+
        alpha = score;
 
       if (alpha > beta) // should be >=
 
       if (alpha > beta) // should be >=
    break;
+
        break;
 
     } else { // minplayer
 
     } else { // minplayer
 
       if (score < alpha)  
 
       if (score < alpha)  
    alpha = score;
+
        alpha = score;
 
       if (alpha < beta) // should be <=
 
       if (alpha < beta) // should be <=
    break;
+
        break;
 
     }
 
     }
 
   }
 
   }

Latest revision as of 18:57, 21 October 2020

Home * Engines * JS Schach

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].

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

External Links

References

Up one level