Author: Tony Werten
Date: 04:37:43 05/07/03
Go up one level in this thread
On May 07, 2003 at 06:20:00, Magoo wrote: >On May 07, 2003 at 05:08:43, Uri Blass wrote: > >>On May 07, 2003 at 04:57:03, Magoo wrote: >> >>>On May 07, 2003 at 03:56:33, Tim Foden wrote: >>> >>>>On May 06, 2003 at 19:24:23, Magoo wrote: >>>> >>>>>After making alot of functions to macros and alot of other stuff, my program is >>>>>much faster!! >>>>>Perft 5 (without evaluating nodes) gives: >>>>>Depth:5, Nodes:5072212, Time:63 sec, Nps:80511, Value:0 >>>>> >>>>>But!! I know other programs (i been looking at mscp and faile) do this >>>>>at least 6 times faster, (that is perft 5 < 10sec). >>>>>I've looked at the source for the programs i compare with, especially faile does >>>>>alot of stuff in the move_generator, mine is smaller, maybe a few more if >>>>>statments. >>>>>Now, if i only could figure out why it is so slow, it shouldn't be!! >>>>> >>>>>Flat profile: >>>>> >>>>>Each sample counts as 0.01 seconds. >>>>> % cumulative self self total >>>>> time seconds seconds calls s/call s/call name >>>>> 66.51 42.12 42.12 5087588 0.00 0.00 move_generator >>>> >>>>> 3.65 56.68 2.31 5087587 0.00 0.00 undo_move >>>>> 3.21 58.71 2.03 5087587 0.00 0.00 do_move >>>> >>>>Does your move generate generate all moves in a position in one go, or do you >>>>only generate one move at a time? >>>> >>>>If you are generating all moves in one go, then it looks like you are calling >>>>your movegen in the leaf nodes. You really should have much fewer calls to your >>>>movegen than to your make/unmake move routines. >>>> >>>>Cheers, Tim. >>> >>>Yes, i do call move_generator in the leaf nodes, i have no better way to check >>>if a move is legal... i look at the moves generated and look for "YxK", that is >>>a move where the king is captured, then i just return -INFINITY and decrease the >>>node count.. >> >>You have better ways to do it. >> >>You do not need to generate all moves only to >>check if the king can be captured. >> >>You should only check if the opponent of that king has pieces in the relevant >>squares. >> >>If the white king is at e1 you need only to look at every direction to check if >>there is check from that direction. >> >>For example if you see >>e2 white pawn then you know no check from that direction >> >>Uri > >Yes, i have a "in_check" function, it does what you say. I will add this check >before generating moves. You can do even better. If you were incheck before making the move do the full check as Uri said. ( Also if the move was a special move like ep or castle) If you weren't incheck, then there is only 1 way of being in check. The fromsquare of the moved piece was attacked by a slider. Find the direction in wich to travel from the kingsquare to the from_square ( easy with 0x88) and look if there is an opponent slider on that line. Tony
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.