Legal or Pseudo-Legal Move generation

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Legal or Pseudo-Legal Moves in Move Generator

Legal
9
43%
Pseudo-Legal
12
57%
 
Total votes: 21

User avatar
Bo Persson
Posts: 243
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: Legal or Pseudo-Legal Move generation

Post by Bo Persson »

Will your search or evaluation depend on the number of legal moves?

Otherwise postponing legality checks until you actually consider performing the move, seems like a win.
Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: Legal or Pseudo-Legal Move generation

Post by Gerd Isenberg »

The lazy paradigm to do stuff as late as possible, which might be never due to cut-off or standing pat in QS, might be relativated by doing stuff in parallel with higher ipc or while waiting for some memory reads...

Some other aspects pro legal movegen - one is aware of stalemate and mate in advance and may use "tactical" information from legal movegen elsewhere i.e. pins in eval or mate at a glance.
User avatar
hgm
Posts: 27809
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Legal or Pseudo-Legal Move generation

Post by hgm »

Bo Persson wrote:Otherwise postponing legality checks until you actually consider performing the move, seems like a win.
You assume here that legal move generation is done by first doing pseudo-legal move generation, followed by checking the move for legality. This need not be true.

For instance, when I have identified a pinned piece, I don't even generate moves for it that leave the pin line. So there is nothing to check, and time is saved on generating the 'pseudo-legal' moves along the pin ray. (Which, in fact, are guaranteed to be legal, and thus need not be checked either.
User avatar
nanochess
Posts: 64
Joined: Thu Feb 19, 2009 5:34 pm
Location: Mexico, Mexico

Re: Legal or Pseudo-Legal Move generation

Post by nanochess »

My vote is for pseudolegal movement generation, is the trick to make Toledo Nanochess very small. :)
By the way, my vote was rejected with a message of 'you're not eligible for this poll'. What this means? :shock: I'm too young?, I'm too tall?, Too few posts? :D
All good things are difficult to achieve.
Toledo Nanochess book http://www.amazon.com/Toledo-Nanochess- ... 1304864375
AlvaroBegue
Posts: 931
Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: Legal or Pseudo-Legal Move generation

Post by AlvaroBegue »

I've only ever used pseudo-legal move generation, but this idea of not trying to move pinned pieces out of their line seems very attractive.
nanochess wrote:By the way, my vote was rejected with a message of 'you're not eligible for this poll'. What this means? :shock: I'm too young?, I'm too tall?, Too few posts? :D
Too handsome. It has to be that. I got the same message.
Chan Rasjid
Posts: 588
Joined: Thu Mar 09, 2006 4:47 pm
Location: Singapore

Re: Legal or Pseudo-Legal Move generation

Post by Chan Rasjid »

AlvaroBegue wrote:I've only ever used pseudo-legal move generation, but this idea of not trying to move pinned pieces out of their line seems very attractive.
...
The only reason most don't do full legal moves generation is all about the cost of knowing the sliding pins; if I am not wrong, there is no cheap workaround, whatever the board representation.

Bob Hyatt's earliest argument was for getting exposed illegality at the gen_of_capture at the next node for XxK. This is what I am doing.

Rasjid