Author: scott farrell
Date: 03:51:55 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(); > 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? the score is often/always the same. print the values of the other moves at root, you'll seem them bounce around, even show mated sometimes. It really only helps with the hashtable with regards to transpositions. Scott
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.