Author: Sune Fischer
Date: 09:19:06 02/17/04
Go up one level in this thread
On February 17, 2004 at 11:49:33, Robert Hyatt wrote: >On February 17, 2004 at 10:48:35, Sune Fischer wrote: > >>On February 16, 2004 at 22:41:00, Robert Hyatt wrote: >> >>>This will make bitmaps insanely difficult to visualize. Remember that bit 0 is >>>the LSB (or rightmost bit). That means your chess board is going to look like >>>this when you display a bitboard as a hex number: >>> >>> >>> >>> h1 g1 f1 e1 d1 c1 b1 a1 >>> >>>Because the rightmost 8 bits would be displayed in that order. >> >>Correct. >> >>> That could drive >>>someone to drink drain cleaner. I might be more tempted to make bit 0 either >>>square h8, or h1 instead, so that things are not impossible to debug... >> >>Why on earth would you want to do something horrible like that? >> > > >When I display a 64 bit word, it pops out in hex. I want some simple way to >translate that 64 bit image into what it represents about each square, so that I >can do it mentally. Currently take the 64 bit word in groups of 8 bits. >leftmost 8 bits is rank 1, next 8 bits is rank 2, all easy to visualize. Of course I want the same, that is why I don't get your 'backwards' way of doing it. bitboard b=..; rank 1: b&0xff rank 2: (b>>8)&0xff etc. I think this orientation is a lot easier mentally due to it corresponding well with a coordinate system, everything begins at the lower left corner! You never begin a coordinate system out at h1 for instance, that would make the x-axis negative :-) Ok, perhaps I am too math-impaired to accept anything else, it simply _must_ be this way for me, going against 15 years of school is too much to handle for me :) >I want >to renumber the bits, but also make the 64 bit value something I can look at and >then visualize without having to "flip" the board as might happen if I just >change the square numbers and leave the bit/square correspondence alone. You have to flip the board by your method AFAICT. At least I don't see how it maps easily starting at some obscure location like h1, do you go up or down from there or just wizz around randomly? How can normality be reconstituted? ;-) >I have to compute square = 63 - bsf(board) > >_that_ subtraction. And that needs a register. > >IE optimal (on opteron): > >bsfq %rax, %rbx ; result in %rbx > >done. result = %rbx > >Currently (on opteron): > >movq $63, %rbx >bsfq %rax, %rcx >subq %rcx, %rbx ; result 63-bsf in %rbx > >That transformation is done everywhere I currently use FirstOne()/LastOne(). > >Because I numbered the bits to avoid that on the Cray. Yes I understood this was some old reminiscence from the Cray, what I didn't know was that you actually liked the transformation :) -S.
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.