Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Programmers: please check my alpha-beta algorithm

Author: Rafael Andrist

Date: 09:03:20 09/29/03

Go up one level in this thread


On September 29, 2003 at 11:49:20, Edward Seid wrote:

>Writing in VB.NET.  Nearly everyone codes in C, but I hope someone can verify
>the correctness of my algorithm.
>I've read various websites and papers about alpha-beta pruning and it seems that
>every pseudocode I've seen, though 95% similar, differs in some detail, whether
>it be the order of statements, naming conventions, or initialization of some
>variables.
>
>So I'll post my VB.NET procedure, in hopes that someone can tell me if it is
>correct or not.  Thanks in advance.
>---------------------
>
>Const NEGATIVEINFINITY as Integer = -2147483647
>Const POSITIVEINFINITY as Integer =  2147483647
>' the board array is a 10x12 mailbox representation
>Public board as Integer() = New Integer(119) {}
>Public epSquare, sideToMove as Integer
>
>' The first call to the AlphaBeta subroutine is like this:
>' bestScore = AlphaBeta(depth, NEGATIVEINFINITY, POSITIVEINFINITY)
>
>
>Function AlphaBeta(ByVal deep As Integer, ByVal alpha As Integer, ByVal beta As
>Integer) As Integer
>      Dim possibleMoves As Integer(,)
>      Dim index, width As Integer


At least in older VB versions, "index" is now of data type Variant, not Integer.
Not sure how VB.NET handles this, but I doubt they fixed this flaw.

Dim index As Integer, width as Integer
would be necessary in older VB versions, otherwise you need more space and more
time for the conversion.

regards
Rafael B. Andrist



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.