c# - A question about AlphaBeta algorithim -
I have experienced Alphabeta algorithms with my old chess engine and now I am trying to write new engine and I It seems that algorithm encounters beta cut off but in my opinion, if I do not use compressed windows then it should never be. am I wrong ? I am using
int.maxValue
for Beta and -int.MaxValue
for alpha, which can be the reason for the beta cut-off?
Edit:
The full code is here. Public results search (intax display) {int alpha = -int.MaxValue, beta = int.MaxValue, ply = maxDepth; Var Bestline = New Stack & Lt; Move & gt; (); Var score = alpha beta (alpha, beta, ply, bestline); Return new results (score, bestline); } F Alphabeta (int alpha, int beta, int ply, stack and lieutenant; move & gt; bestline) {if (ply & lt; = 0) return evaluation. evaluation board); Var Moves = Board. Generatesmows (); Fresh (various steps in tricks) {Board.MakeMove (move); Eval = - alpha beta (-beta, -lmfah, fly-1, bestline); Board.TakeBackMove (move); If (eval> = beta) {return beta; } If (eval> alpha) {alpha = eval; If (Plei == 1) Best LAN Clear (); BestLine.Push (move); }} Return alpha; }}
OK, you are right on MinValue / MaxValue thing
I'm a little confused about Nega Max and Alpha Beta, but when I see
if (eval> = beta) {return beta; } If (eval> alpha) {}
for both ranges & gt;
are testing, which does not seem right
EDIT: It seems that these are the kinds of naming / understanding issues. Your alphabeta ()
method may have more accurate name NegaMaxWithAlphaBeta ()
. Due to the alternate roles of alpha and beta in NegaMax, those standards are not an exact match with MiniMax.
I think algorithm encounters beta cutoffs but in my opinion, it should never be
Yes, it should be and it should be only ply There is only one beta-cutoff on the levels at the strangest level, if (eval> = beta)
test for an alpha cutoff
If I use the compressed window Does not use
I think you are using a short alpha / beta window.
But this answer may help to better explain your problem.