I think that loosing the meaning of upperbound and lowerbound is not a good idea. The upper bound could be smaller in a conventional null window search, and be equal when beta=alpha+1 in the standard case. So the test to update alpha and beta should be done separately wihtout assuming score>=alpha to imply score > beta. I didn't check it properly but your second code block may need to be modified like so. If that is the case, then it proves the point that it is a recipe for problems, but i am sure it is possible to make it work though it probably won't bring advantages. Knuth describes alpha-beta as the F2 procedure like thisThe search2 function does contain two additional arithmetic operations though, score+1 and minExact-1. A real implementation would likely want to test if the current range is a null window. This test is (beta<=alpha+1) in the classical implementation, but would become (maxExact<minExact) in the alternative implementation
Code: Select all
F2(p, alpha, beta) <= alpha if F(p) = alpha,
F2(p, alpha, beta) = F(p) if alpha < F(p) < beta
F2(p, alpha, beta) >= beta if F(p) >= beta.
Code: Select all
F1(p, beta) = F(p) if F(p) < beta,
F1(p, beta) >= beta if F(p) >=beta