Author: Bruce Moreland
Date: 00:19:40 03/06/99
Go up one level in this thread
On March 05, 1999 at 22:31:51, Matt wrote: >On March 05, 1999 at 21:09:11, Bruce Moreland wrote: >>In a 128-element board, if you subtract d1 from e1 you'll still get 1, but if >>you subtract h1 from a2 you'll get 9, which makes sense because a2 is not one >>square to the right of h1. > >I understand this as well, but what is the value of 9? i understand h1 is 7 and >a2 is 16, and subtracting them gets the value of 9, but I don't understand how >this will be useful. 9 is also the difference between two squares diaganol from >each other. more below. The point is that 9 indicates a non-relationship. 9 isn't useful. And 9 isn't a diagonal up and to the right in a 128-element board, 17 is. >>This holds true of any relationship between any two squares. You can make use >>of this to determine if it's possible to get from one square to another square, >>in order to build an in-check routine or a static exchange evaluator. > >I am not sure how you would use this to see if its possible to get from one >square to another. ie. if you are calculating moves for a bishop, one of the >offsets is -9... if you hit a2 -9, you hit h1, so how does the bounds checking >work in this case? Ok. You start out at a2, which isn't 9, it's 16. You go down and to the left, do this you subtract 17. That's -1. -1 & 0x88 is non-zero. In this case both of the bits are set, since the thing went off the bottom and off the left side. bruce
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.