Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Chess/AI Programming help..(?)

Author: David Mitchell

Date: 18:42:53 08/26/05

Go up one level in this thread


On August 26, 2005 at 20:41:56, Steve Lim wrote:

>On August 26, 2005 at 04:34:18, David Mitchell wrote:
>
>>
>>Good heaven, Steve. That's exactly what I'm doing, right now. I'm a hobby
>>programmer, and am writing up my chess engine in C. (VC 6)
>
>May the force be with you. =)
>
>>Trust me, it's very basic! :) You wouldn't mistake it for anything Bruce,
>>Robert, or Tom Kerrigan wrote. Alas, it is not elegant or short, either.
>
>I think the word 'basic' is very subjective. =) Let me put it to you this way...
>I'm starting with C and tictactoe with 'C Programming Visual Quickstart Guide'
>as my handholding syntax reference. =)
>
>>
>>I may not be able to answer all your questions, but I'm sure willing to give it
>>a shot.
>>
>>Dave
>
>Many thanks. The thing that bugs me most is understanding and implementing
>minimax. I understand that you have to go down the tree then up the tree etc.
>But the implementation is still very alien to me. UnmakeMove()(?).. I initially
>thought getting an explaination in english instead of code would be better.. now
>I'm not so sure.
>
>My plan is to implement it in tictactoe. If I can't understand that, better to
>give up right now. =)
>
>Thanks,
>Steve.

You may very well not understand minimax when you first see it. Reason is that a
lot of the "housekeeping" work is done "behind the scenes", by the stack for
each call. So you watch it work, and it's on move #4 at ply three, then it goes
down to ply 4, then to ply 5, then it looks at 3 more moves, then it comes back
up to ply 4, does some more work, then back to ply 3, where you started watching
it. And yet somehow, it's right back where it should be, even though no
variables for that were explicitly saved by the program. But with each recursive
call, the old stack's info was saved, and when it's needed - POOF! there it is,
holding all the right values.

By 'stack', I mean a 'frame stack' of memory that is saved prior to every call
to a function. You don't see it, and you don't have to do anything to make it
happen. In a highly recursive function, it's a big, big, plus.

Dave



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.