Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Some questions.......

Author: Roberto Waldteufel

Date: 10:01:28 09/19/98

Go up one level in this thread



On September 19, 1998 at 11:14:40, Guillem Barnolas wrote:

>
>     I am currently developing a pascal chess program which I think will be
>quite weak, because to generate legal moves I'm generating all the moves and
>then discarding the ones that leave the king in check... Generating only legal
>ones seems quite tough..


Have you considered generating pseudo-legal moves for the sake of speed, then
simply testing if the king is in check after making the move?

> I now crafty does, but considering it's in C and uses
>bitboards, it's quite difficult for me to understand it.. I tried tscp, but it
>uses the same technique that me (I should say i use the same that it uses..;) I
>have thought of some way of doing this, but seem a little weird... I'll try to
>explain in few words... I thought I could go from the king_position looking if
>there are friendly pieces blocking possible attacks...(I think I might have seen
>this in Crafty or some other program, as X_ray attacks...) and mark those
>friendly pieces...afterwards i go through all the board and for non-marked
>pieces I generate all the movements.. for pieces marked once I generate captures
>to the attacking piece and movements on that direction.. for the pieces marked
>more than once I generate no movements... I don't know If this would miss
>anything... I haven't implemented it because I'm still fighting with the program
>;-D...

This sounds OK to me, except that for pieces marked only once they can also move
in the opposite direction as the attacker, as long as they stay between the king
and the pinning piece.


>
>     Another thing is I don't have principal variation storing quite clear... I
>saw in one page it's usually stored as a two dimension array, but don't
>understand quite well the updating part... I mean, If I'm on ply 4 and happen to
>find a better movement than the one I had before I still have to know If I was
>following the PV, because If not I would mess everything up...


In a recursive search function, you can return a "mini-PV" from every node
searched, so the final return from the root node contains the full PV. Whenever
a move returns the best value so far at a node, you append that move to the
start of the PV just returned. When you have searched all the moves, you are
ready to return the PV for that node. If you get a cutoff before that, you know
the node cannot be a PV node, so you can return a null PV.


Here's some pseudocode:

global PV as string

Function Search(alpha,beta,depth)

if depth<=0 then
  return value(position)
end if

minv=-infinity
for each move

    make move
    v=-search(-beta,-alpha,depth-1)
    unmake move

    if v>minv then
       if v>=beta then
           PV=""
           return v
       end if
       alpha=max(v,alpha)
       minv=v
       PV=move+PV
    end if

next move

return minv



>
>     And to finish, I have been looking for some books on the subject but happen
>to see that all are out-of-prints one, except from the "Kasparov vs Deep Blue:
>Computer chess comes of age" which seems to be quite an historical aproach but
>seems to cover few technical aspects...
>
>     If you can help me on any of this subjects I would be very pleased....

I hope the above helps

Best wishes,
Roberto



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.