Author: Russell Reagan
Date: 16:03:54 09/16/04
Go up one level in this thread
On September 16, 2004 at 16:43:18, Stuart Cracraft wrote: >I'm talking vanilla, i.e. compare > > if (board[H8+OFFSET] == OFFBOARD) <== mailbox > >vs. > > if (((H8+OFFSET) & 0x88))) <== 0x88 method > >We're trading a memory reference for an AND, right? >If memory items are pre-fetched in cache it becomes >a cache lookup vs. an in-register logical operation >for the basic off-board question. IIRC, the original point of the 0x88 trick was to avoid an expensive memory lookup. At that time a memory lookup was much more expensive than it is today (due to cache). Chances are that your board, being the most accessed area of memory while your program is running, will be in the cache. In addition, most of the time you are going to check the memory anyway. I think a 16x16 or 12x16 board will work better for you. Read this: http://chessprogramming.org/cccsearch/ccc.php?art_id=114377 >More importantly, for the attack / incheck detector, to see >if there is any point in checking for an attack from >a piece to a square (or enemy king), ignore if square not reachable >due to no ray between, based on auxillary table single lookup (not >available in mailbox so >=N ops) otherwise go to each square (comparable >to mailbox.) Looks like one could avoid N operations here since the >check along the ray can be completely avoided by prior knowledge. I believe this is the major benefit of using a board that has unique square relationships like 0x88. You can write more efficient algorithms. You can use a 64x64 table with your mailbox approach to do the same thing as you mentioned, but you are using 4096 elements instead of 256 or 128, and doing a 2D array lookup instead of a 1D array lookup.
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.