| View previous topic :: View next topic |
| Author |
Message |
Allard Siemelink
Joined: 30 Jun 2006 Posts: 297 Location: Netherlands
|
Post subject: Re: Perishing Perft ! Posted: Sun May 20, 2007 12:16 am |
|
|
| GeoffW wrote: |
Hi Allard
Could you explain in more detail where and when you are making and unmaking moves. There is possibly a simple optimisation that hasn't occurred to me yet ?
Regards Geoff |
Hi Geoff,
The perft is coded like this:
| Code: |
uint Board::perft(int depth, Move last) {
Move moves[256];
Move *m2 = genAllMoves(moves, last);
uint n=0;
State state = save();
for (Move *m=moves; m<m2; m++) {
if (!(last=move(*m))) continue;
if (depth>1) n += perft(depth-1, last);
else n++;
undo(*m, state);
}
return n;
}
|
Things to note:
-genAllMoves() generates pseudo legal moves.
-move() will check if the move is legal (0 is returned for illegal moves)
-move() will set the check flag in the returned Move if the move was check;
genAllMoves() will generate just check evasions if this check flag is set.
To quickly detect checks, move() looks at the piece type of the moving piece and its new location. For sliders, the old 0x88 trick is used to avoid
scanning the board if a slider cannot possibly deliver checks regardless of blocking pieces. Discoverd checks are handled the same way, but by looking at the location that was vacated by the piece.
Hope this helps. |
|
| Back to top |
|
 |
|
| Subject |
Author |
Date/Time |
Perishing Perft ! |
GeoffW |
Thu May 17, 2007 4:26 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Thu May 17, 2007 5:07 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Thu May 17, 2007 5:10 pm |
Re: Perishing Perft ! |
pijl |
Thu May 17, 2007 5:11 pm |
Re: Perishing Perft ! |
Steven Edwards |
Thu May 17, 2007 5:18 pm |
Re: Perishing Perft ! |
Steven Edwards |
Thu May 17, 2007 6:16 pm |
Re: Perishing Perft ! |
Uri Blass |
Thu May 17, 2007 6:22 pm |
Re: Perishing Perft ! |
Alessandro Scotti |
Thu May 17, 2007 6:44 pm |
Re: Perishing Perft ! |
H.G.Muller |
Fri May 18, 2007 6:46 am |
Re: Perishing Perft ! |
Uri Blass |
Fri May 18, 2007 7:59 am |
Re: Perishing Perft ! |
Dann Corbit |
Fri May 18, 2007 9:25 pm |
Re: Perishing Perft ! |
Uri Blass |
Fri May 18, 2007 9:59 pm |
Re: Perishing Perft ! |
Dann Corbit |
Tue May 22, 2007 4:08 am |
Depth 9, SAN order |
Steven Edwards |
Thu May 17, 2007 7:20 pm |
Re: Depth 9, SAN order |
Reinhard Scharnagl |
Sat May 19, 2007 9:13 pm |
Re: Perishing Perft ! |
Uri Blass |
Thu May 17, 2007 5:52 pm |
Re: Perishing Perft ! |
H.G.Muller |
Thu May 17, 2007 6:11 pm |
Re: Perishing Perft ! |
GeoffW |
Sat May 19, 2007 3:46 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Sat May 19, 2007 5:05 pm |
Re: Perishing Perft ! |
GeoffW |
Sat May 19, 2007 5:29 pm |
Re: Perishing Perft ! |
Alessandro Scotti |
Sat May 19, 2007 5:53 pm |
Re: Perishing Perft ! |
Alessandro Scotti |
Sat May 19, 2007 6:16 pm |
Re: Perishing Perft ! |
GeoffW |
Sat May 19, 2007 8:14 pm |
Re: Perishing Perft ! |
Alessandro Scotti |
Sat May 19, 2007 8:34 pm |
Re: Perishing Perft ! |
Reinhard Scharnagl |
Sat May 19, 2007 8:42 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Sun May 20, 2007 12:16 am |
Re: Perishing Perft ! |
Reinhard Scharnagl |
Sun May 20, 2007 12:29 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Sun May 20, 2007 2:54 pm |
Re: Perishing Perft ! |
Ross Boyd |
Sat May 19, 2007 10:19 pm |
Re: Perishing Perft ! |
Filip Tvrzsky |
Sun May 20, 2007 1:51 am |
Re: Perishing Perft ! |
H.G.Muller |
Sun May 20, 2007 8:08 pm |
Re: Perishing Perft ! |
Filip Tvrzsky |
Sun May 20, 2007 9:08 pm |
Re: Perishing Perft ! |
GeoffW |
Sun May 20, 2007 10:56 pm |
Re: Perishing Perft ! |
Allard Siemelink |
Mon May 21, 2007 10:26 pm |
Re: Perishing Perft ! |
H.G.Muller |
Tue May 22, 2007 7:50 am |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|