Author: Dan Newman
Date: 15:13:52 02/06/00
Go up one level in this thread
On February 06, 2000 at 14:02:58, William Bryant wrote: >On February 06, 2000 at 12:17:50, James Robertson wrote: > >>On February 06, 2000 at 08:08:36, Marek Mahdal wrote: >> >>>I need a algorithm, that generates all possible moves in a position. Is there >>>anybody, who can help me ??? >> >>As far as I know everybody uses something similar: >> >>a) scan the entire board finding pieces >>b) once you find a pice, generate moves for it and add them to the move list. >>c) take care of extras (castling, ep, etc) >> >>I don't know if I would call this an algorigthm, since everybody does it so >>differently, but this is basically how moves are generated. >> >>James > >Although this _is_ how I do it at present. > >You can also keep a piece list, or use piece bitboards and simply >walk through the list generating moves for each piece. Some, Dan Corbit >comes to mind, feel that significant time is wasted walking through the >board to find each piece for the side on move. > Walking through the board does slow down move generation, however, move generation is usually only perhaps 10 or 20 % of the time taken--that varies widely depending how much eval is done, etc. But with no eval it's been (typically) 15-20% for me. The problem is there are other places you need to get at each side's pieces. In fact you really need to get at them in order, which you can't do scanning the board. (SEE for example can be done much faster with the pieces already ordered.) This is what I like best about bitboards, I think. Each type of piece has its own bitboard, so you can generate moves in order of piece type and easily do the SEE calculation w/o sorting or whatever. And no need to expand, re-order, or contract piece lists as pieces are captured, promoted, or restored... >What I would like is someone to explain a simple method for generating sliding >piece moves from bitboards. How to quickly determine where sliding pieces >stop moving because their path is blockes. Heh. I just scan the board. I've tried several other schemes using the bitboards, but scanning seems always to come out on top. I don't do rotated bitboards yet, but I plan to (maybe) try them. Bob has an article in the most recent ICCAJ on rotated bitboards and he gives a little code snippet on how to do this w/o rotated bitboards using first_one() and last_one(). (I tried something like that, and it was *really* slow.) -Dan. > >William >wbryant@ix.netcom.com
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.