Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Move Generator

Author: Russell Reagan

Date: 17:08:03 12/19/02

Go up one level in this thread


On December 19, 2002 at 19:53:46, Andreas Herrmann wrote:

>but a pseudo legal move generator is faster. You have to check if the king is in
>check only if you must evaluate a position.

I don't understand why you only have to test if the king is in check if you must
evaluate a position. I do something like this:

search(...)
  if depth is 0, return eval()
  generate pseudo-legal moves
  for each move
    make the move
    if the king is in check
      undo the move
      go to the next move
    move found = true
    score = -search(...)
    undo move
    if score >= beta, return beta
    if score > alpha, alpha = score
  if !move found
    if in check, return mate score
    else, return draw score
  return alpha

How do you do it without having to check if every move leaves the king in check?

Russell



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.