Author: Tony Werten
Date: 00:29:25 09/08/03
Go up one level in this thread
On September 08, 2003 at 01:55:14, Russell Reagan wrote: >I think I understand the differences and between fail hard alpha-beta and fail >soft alpha-beta when described in higher level language (like English), but I'm >a bit shaky on the implementation differences between the two. > >As I understand it, this is fail hard alpha-beta (from Bruce's site): > >int AlphaBeta(int depth, int alpha, int beta) >{ > int val; > if (depth == 0) > return Evaluate(); > GenerateLegalMoves(); > while (MovesLeft()) { > MakeNextMove(); > val = -AlphaBeta(depth - 1, -beta, -alpha); > UnmakeMove(); To make it more clear, change the next for lines into if (val>best_score) best_score=val; * if (best_score>= beta) return best_score; if (best_score> alpha) alpha = best_score; } return best_score; } The only difference between fail soft and fail hard is now wether you initialize best_Score with -oo or alpha. (* well, almost... For a clean failhard you should lower best_score to beta, if it is higher ) Tony > if (val >= beta) > return beta; > if (val > alpha) > alpha = val; > } > return alpha; >} > >How would this function be rewritten to perform fail soft alpha-beta? My best >guess is this (changes commented): > >int AlphaBeta (int depth, int alpha, int beta) { > int val; > if (depth == 0) > return Evaluate(); > GenerateLegalMoves(); > while (MovesLeft()) { > MakeMove(); > val = -AlphaBeta(depth - 1, -beta, -alpha); > UndoMove(); > if (val >= beta) > return val; // <-- Return val instead of beta > if (val > alpha) > alpha = val; > } > return val; // <-- Return val instead of alpha >} > >Also, when called with an infinite window (ex. AlphaBeta(depth, -INFINITY, >INFINITY)), both the fail soft and fail hard versions should give the same >score, correct?
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.