Hi,
Now that perft all works, I was looking at the "divide"-test.
Googling learned me that people are using it, but I could not find a definition of it anywhere. So: how does it work? What does it do?
divide?
Moderator: Ras
-
hgm
- Posts: 28454
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: divide?
Divided perft is just that the total count is split over all moves from the current position. So that if the total count is incorrect, you know in which branch the error occurs.
Similarly, higher-oder divided perft splits out the count per sequence of moves. This can help you to zoom in on the error in cases where you get a wrong counts for move X, but you then get a correct count when using the position after X as a starting point for a separate perft. (This can for instance happen if move X wrongly altered castling rights.)
E.g. qperft allows you to divide at any level of the tree; "qperft 6 -2" would show you all perft(5) from the individual root moves, "qperft 6 -3" would show them at level 3 of the tree (where the root is level 1), etc. But after more than 3 levels you get an impractical amount of output (from a crowded start position).
Similarly, higher-oder divided perft splits out the count per sequence of moves. This can help you to zoom in on the error in cases where you get a wrong counts for move X, but you then get a correct count when using the position after X as a starting point for a separate perft. (This can for instance happen if move X wrongly altered castling rights.)
E.g. qperft allows you to divide at any level of the tree; "qperft 6 -2" would show you all perft(5) from the individual root moves, "qperft 6 -3" would show them at level 3 of the tree (where the root is level 1), etc. But after more than 3 levels you get an impractical amount of output (from a crowded start position).
-
xmas79
- Posts: 286
- Joined: Mon Jun 03, 2013 7:05 pm
- Location: Italy
Re: divide?
This is the output of my perft in the initial position (it is really a divide implementation):
1st field: move number
2nd field: move
3rd field: leaf count after "move" at depth 5
4th field: fen string after "move"
With this kind of output you can see pretty fast where the error is, and load the fen which gives wrong number and run a perft at depth D-1, and so on...
Code: Select all
perft 6
1 Nb1-a3 4856835: rnbqkbnr/pppppppp/8/8/8/N7/PPPPPPPP/R1BQKBNR b KQkq -
2 Nb1-c3 5708064: rnbqkbnr/pppppppp/8/8/8/2N5/PPPPPPPP/R1BQKBNR b KQkq -
3 Ng1-f3 5723523: rnbqkbnr/pppppppp/8/8/8/5N2/PPPPPPPP/RNBQKB1R b KQkq -
4 Ng1-h3 4877234: rnbqkbnr/pppppppp/8/8/8/7N/PPPPPPPP/RNBQKB1R b KQkq -
5 a2-a3 4463267: rnbqkbnr/pppppppp/8/8/8/P7/1PPPPPPP/RNBQKBNR b KQkq -
6 b2-b3 5310358: rnbqkbnr/pppppppp/8/8/8/1P6/P1PPPPPP/RNBQKBNR b KQkq -
7 c2-c3 5417640: rnbqkbnr/pppppppp/8/8/8/2P5/PP1PPPPP/RNBQKBNR b KQkq -
8 d2-d3 8073082: rnbqkbnr/pppppppp/8/8/8/3P4/PPP1PPPP/RNBQKBNR b KQkq -
9 e2-e3 9726018: rnbqkbnr/pppppppp/8/8/8/4P3/PPPP1PPP/RNBQKBNR b KQkq -
10 f2-f3 4404141: rnbqkbnr/pppppppp/8/8/8/5P2/PPPPP1PP/RNBQKBNR b KQkq -
11 g2-g3 5346260: rnbqkbnr/pppppppp/8/8/8/6P1/PPPPPP1P/RNBQKBNR b KQkq -
12 h2-h3 4463070: rnbqkbnr/pppppppp/8/8/8/7P/PPPPPPP1/RNBQKBNR b KQkq -
13 a2-a4 5363555: rnbqkbnr/pppppppp/8/8/P7/8/1PPPPPPP/RNBQKBNR b KQkq -
14 b2-b4 5293555: rnbqkbnr/pppppppp/8/8/1P6/8/P1PPPPPP/RNBQKBNR b KQkq -
15 c2-c4 5866666: rnbqkbnr/pppppppp/8/8/2P5/8/PP1PPPPP/RNBQKBNR b KQkq -
16 d2-d4 8879566: rnbqkbnr/pppppppp/8/8/3P4/8/PPP1PPPP/RNBQKBNR b KQkq -
17 e2-e4 9771632: rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq -
18 f2-f4 4890429: rnbqkbnr/pppppppp/8/8/5P2/8/PPPPP1PP/RNBQKBNR b KQkq -
19 g2-g4 5239875: rnbqkbnr/pppppppp/8/8/6P1/8/PPPPPP1P/RNBQKBNR b KQkq -
20 h2-h4 5385554: rnbqkbnr/pppppppp/8/8/7P/8/PPPPPPP1/RNBQKBNR b KQkq -
Time elapsed: 18.93000 seconds
Total leaf nodes: 119060324
6.3M LNPS2nd field: move
3rd field: leaf count after "move" at depth 5
4th field: fen string after "move"
With this kind of output you can see pretty fast where the error is, and load the fen which gives wrong number and run a perft at depth D-1, and so on...
-
xmas79
- Posts: 286
- Joined: Mon Jun 03, 2013 7:05 pm
- Location: Italy
Re: divide?
Please note that perft 6 from initial position is usually not enough, as at depth 6 white didn't castled yet. There are a lot of "better" perft positions that were already pointed out in the other thread. If your engine is fast enough you could try to go one or two plies deeper. This can catch some other subtle bug...
-
sedicla
- Posts: 182
- Joined: Sat Jan 08, 2011 12:51 am
- Location: USA
- Full name: Alcides Schulz
Re: divide?
You may try some positions from wiki page:
http://chessprogramming.wikispaces.com/Perft+Results
Hope this helps!
http://chessprogramming.wikispaces.com/Perft+Results
Hope this helps!