Importing perft to move generato

Discussion of chess software programming and technical issues.

Moderator: Ras

ethanara
Posts: 134
Joined: Mon May 16, 2011 6:58 pm
Location: Denmark

Importing perft to move generato

Post by ethanara »

I see that programs like qperft , using mailbox, has faster move generating than a chess engine using magics, how is this possible, when magics should be faster than mailbox?
Also , in theory, is it possible to import a perft into a move generator?
Sorry for such a noobish question and my bad english,
Ethan
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Importing perft to move generato

Post by Sven »

ethanara wrote:I see that programs like qperft , using mailbox, has faster move generating than a chess engine using magics, how is this possible, when magics should be faster than mailbox?
What do you mean by "faster move generating"? Which numbers do you compare? The move generation itself, plus making/unmaking moves, might be faster with magic bitboards but there is more to consider than just that.

NPS (nodes by second, if that is the measurement of speed you focus on) of a bitboard chess engine performing a regular search is (usually) lower than NPS of a perft function, for at least two reasons:

1) The perft function does not include position evaluation, which usually has the highest cost when doing a regular search.

2) Many perft functions save making/unmaking moves at the last ply since they use a fully legal move generator and can return the exact number of leaves at each frontier (pre-horizon) node. A regular searcher can't do that, it normally does not count a node that it does not visit.

The second point could be neutralized by specifying that NPS for perft should be based on the visited number of nodes, not the calculated number of leaves.
ethanara wrote:Also , in theory, is it possible to import a perft into a move generator?
You are mixing two different things. "perft" is not a kind of move generator but a function that counts all leaf nodes at exactly depth N reachable with legal play. It uses basically a move generator and the make/unmake functions and is therefore comparable to a (minimax) search function. So the answer is "no, you cannot import perft into a move generator, for the same reason as you cannot plug a car into its own motor".

Sven
ethanara
Posts: 134
Joined: Mon May 16, 2011 6:58 pm
Location: Denmark

Re: Importing perft to move generato

Post by ethanara »

Sorry for having confused you.
I know that perft uses a move generator, but can you import that movgen and use it in a chess engine, and would that be faster?
Also , what is the speed of crafty and stockfish and others perft?
Thanks,
Ethan
User avatar
hgm
Posts: 28483
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Importing perft to move generato

Post by hgm »

Move generation and MakeMove is usually a lot faster for mailbox than for bitboard.

In an engine bitboard has some advantages, though: you can much easier selectively generate moves. With mailbox generating only captures is hardly faster than generating all moves. And in an engine you want to do that a lot, since most nodes are QS nodes. But in perft you always want all moves anyway. Bitboard also makes it easier to test if two pieces can capture each other, which has little to do with move generation, but allows you to make quick search decisions.