I try to find out if my quiescence search does not accidentally skip moves.
So I extracted a perft out of that code. It does only promotions, captures and en passant moves.
Result for kiwiPete: "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1"
depth 4: 3980
depth 5: 25800
Don't know if these figures are correct.
Are there any other perft figures published/posted for quiescence search ?
QSearch perft
Moderators: hgm, Rebel, chrisw
-
- Posts: 1871
- Joined: Sat Nov 25, 2017 2:28 pm
- Location: France
Re: QSearch perft
You dont generate check evasion so are you stoping when King is captured ?
-
- Posts: 7221
- Joined: Mon May 27, 2013 10:31 am
Re: QSearch perft
If king is captured it was an illegal move so it returns 0. Just like a normal perft definition but limited to performing only legal captures, promotions and en passant moves.
-
- Posts: 1568
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: QSearch perft
Henk,
With only captures and promotions (and check evasions) I get on kiwipete:
Depth 4 = 3690
Depth 5 = 25347
So my numbers are different, maybe something wrong with your enpassant captures?
Of course there is a possibility that my perft() is in error, but I doubt it.
With only captures and promotions (and check evasions) I get on kiwipete:
Depth 4 = 3690
Depth 5 = 25347
So my numbers are different, maybe something wrong with your enpassant captures?
Of course there is a possibility that my perft() is in error, but I doubt it.
-
- Posts: 7221
- Joined: Mon May 27, 2013 10:31 am
Re: QSearch perft
Strange my code does ep moves. Can't find it. Or maybe minor promotions. Don't know yet.
I created an extra QPerft with code that collects captures, promotions and ep moves similar to code used in my normal perft test giving standard values for kiwi pete 4 and 5 so that code must be correct. But QPerft getting same figures as posted.
Simpel QPerft:
I created an extra QPerft with code that collects captures, promotions and ep moves similar to code used in my normal perft test giving standard values for kiwi pete 4 and 5 so that code must be correct. But QPerft getting same figures as posted.
Simpel QPerft:
Code: Select all
public static ulong Perft2(IChessPosition position, int depth, bool epMoves = true)
{
var moves = new List<IMoveBase>();
position.CollectCaptures(moves, depth, epMoves); // collects captures, epmoves, promotions
if (depth == 1) return (ulong)moves.Count;
ulong count = 0;
var board = position.Board;
var other = board.Other;
foreach (MoveBase mv in moves)
{
var field = mv.GetCaptureLocation(position);
var capture = field == 0 ? none : board.PieceSort(field);
mv.Apply(position);
count += Perft2(position, depth - 1, true); //board.PieceKind(mv.End) == Pawn_Kind);
mv.TakeBack(position, capture, field, other);
}
return count;
}
Last edited by Henk on Fri May 24, 2019 2:43 pm, edited 1 time in total.
-
- Posts: 1568
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: QSearch perft
These are the counts I get per move at depth 4, maybe it helps.
g2h3: 381
d5e6: 436
e5g6: 495
e5d7: 642
e5f7: 475
e2a6: 343
f3h3: 397
f3f6: 521
Maybe somebody else can verify these numbers.
I think the difference is due to the fact that you don't generate check-evasions, because check-evasions will contain non captures too. So you have to generate evasions when the king is in check. You have to do this in quiescence too, otherwise your quiescence will make very big errors.
g2h3: 381
d5e6: 436
e5g6: 495
e5d7: 642
e5f7: 475
e2a6: 343
f3h3: 397
f3f6: 521
Maybe somebody else can verify these numbers.
I think the difference is due to the fact that you don't generate check-evasions, because check-evasions will contain non captures too. So you have to generate evasions when the king is in check. You have to do this in quiescence too, otherwise your quiescence will make very big errors.
Last edited by Joost Buijs on Fri May 24, 2019 3:05 pm, edited 3 times in total.
-
- Posts: 7221
- Joined: Mon May 27, 2013 10:31 am
Re: QSearch perft
Wait this code can't be correct for CollectCaptures does not check whether move is legal (it may place king in check)Henk wrote: ↑Fri May 24, 2019 2:27 pm Strange my code does ep moves. Can't find it. Or maybe minor promotions. Don't know yet.
I created an extra QPerft with code that collects captures, promotions and ep moves similar to code used in my normal perft test giving standard values for kiwi pete 4 and 5 so that code must be correct. But QPerft getting same figures as posted.
Simpel QPerft:Code: Select all
public static ulong Perft2(IChessPosition position, int depth, bool epMoves = true) { var moves = new List<IMoveBase>(); position.CollectCaptures(moves, depth, epMoves); // collects captures, epmoves, promotions if (depth == 1) return (ulong)moves.Count; ulong count = 0; var board = position.Board; var other = board.Other; foreach (MoveBase mv in moves) { var field = mv.GetCaptureLocation(position); var capture = field == 0 ? none : board.PieceSort(field); mv.Apply(position); count += Perft2(position, depth - 1, true); //board.PieceKind(mv.End) == Pawn_Kind); mv.TakeBack(position, capture, field, other); } return count; }
I first have to change that. But then I expect the figures to be even lower then I posted before.
-
- Posts: 7221
- Joined: Mon May 27, 2013 10:31 am
Re: QSearch perft
Now I get:Joost Buijs wrote: ↑Fri May 24, 2019 2:03 pm Henk,
With only captures and promotions (and check evasions) I get on kiwipete:
Depth 4 = 3690
Depth 5 = 25347
So my numbers are different, maybe something wrong with your enpassant captures?
Of course there is a possibility that my perft() is in error, but I doubt it.
Depth 4 = 3622
Depth 5 = 24467
-
- Posts: 1568
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: QSearch perft
You really have to generate check-evasions when the king is in check (blocking moves and king moves to get out of check) if you want to be correct.
Unfortunately I have to modify my code if I want to do it your way (to check if the king is captured), so it is not straightforward to compare our numbers.
Unfortunately I have to modify my code if I want to do it your way (to check if the king is captured), so it is not straightforward to compare our numbers.
-
- Posts: 434
- Joined: Fri Dec 16, 2016 11:04 am
- Location: France
- Full name: Richard Delorme
Re: QSearch perft
I get the same number as you :Joost Buijs wrote: ↑Fri May 24, 2019 2:43 pm These are the counts I get per move at depth 4, maybe it helps.
g2h3: 381
d5e6: 436
e5g6: 495
e5d7: 642
e5f7: 475
e2a6: 343
f3h3: 397
f3f6: 521
Maybe somebody else can verify these numbers.
I think the difference is due to the fact that you don't generate check-evasions, because check-evasions will contain non captures too. So you have to generate evasions when the king is in check. You have to do this in quiescence too, otherwise your quiescence will make very big errors.
Code: Select all
g2h3 381
d5e6 436
e5g6 495
e5d7 642
e5f7 475
e2a6 343
f3h3 397
f3f6 521
total : 3690 leaves
and at depth 5:
Code: Select all
g2h3 2617
d5e6 3202
e5g6 3482
e5d7 4086
e5f7 2908
e2a6 2285
f3h3 2768
f3f6 3999
total : 25347 leaves
Richard Delorme