Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Random search in a binary tree.

Author: Dan Andersson

Date: 17:20:19 03/31/04

Go up one level in this thread


 A few corrections:

>-- Binary Alpha-Beta search
>-- this one only works on even depths
>function AlphaBeta(position, depth, alpha, beta)
>    local move
>    nodes = nodes + 1
>    if depth == 0 then return distribution(position) end

function AlphaBeta(position, depth, alpha, beta)
    local move
    if depth == 0 then
        nodes = nodes + 1
        return distribution(position)
    end

>assert(even(minply) and even(step), "minply and step must be even")
>for depth = minply, maxply, step do
>    for i = 1, 10 do
>        nodes = 0
>        minimax = 2^depth
>        abnodes = math.sqrt(minimax)
>        print(AlphaBeta(0, depth,-1,2^depth + 1), depth, nodes, nodes/minimax,
>nodes/abnodes)
>    end
>end

assert(even(minply) and even(step), "minply and step must be even")
for depth = minply, maxply, step do
    for i = 1, 10 do
        nodes = 0
        minimax = 2^depth
        abnodes = 2*math.sqrt(minimax)-1
        print(AlphaBeta(0, depth, -1, 2^depth + 1), depth, nodes, nodes/minimax,
nodes/abnodes)
    end
end



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.