Bitboards' Little Helper (New free tool)

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
JuLieN
Posts: 2949
Joined: Mon May 05, 2008 12:16 pm
Location: Bordeaux (France)
Full name: Julien Marcel

Bitboards' Little Helper (New free tool)

Post by JuLieN »

After the suggestions and comments I received in the thread for my previous release of this tool I put some more work into it and came up with this new improved version, that I can't qualify anymore of "crude". :)

Here's the readme, with what it does and what's new :
Bitboards' Little Helper is a small tool designed to help chess engines programmers with bitboards.

You can:
- edit each individual bit of the board
- edit a whole rank or column (by clicking its number or letter)
- clear/set/invert the whole board
- copy a bitboard into another one (hence using a bitboard as a backup of the otehr one)
- execute boolean operations between the two first bitboards
- edit, copy and paste from/to the conversion textfields

The corresponding value in binary, hexadecimal and decimal notations is updated in real time.

This tool is free of charge and may be freely distributed, providing you keep this readme file intact and in the archive.

Feel free to contact me for any suggestion of improvement at jul_marcel at hotmail dot com.

/Julien MARCEL


History:
--------

2011-05-12 : Second version
Changes:
- added two bitboards, for a total of 3, the 3rd one displaying the results of operations on the other ones
- added boolean operations : and, and not, or, xor
- the conversion labels have been replaced with textfields that you can edit and copy/paste from/to
- added two more "modes" for the lsb/msb orientation of your bitboards
- slightly changed the name
2011-05-11 : First version
And a screenshot:
Image

Hopefully it will prove as useful to you as it is for me. :)

You can download it here: http://julien.marcel.free.fr/public/BLH_Win.rar

Now for some replies to the previous thread:
Giorgio Medeot wrote:Edit: Oh, well, it seems I will have to beat my laziness, in the end, as I put the LSB on a8... :D
Nope, I added your two modes: the one you mistakenly described, and the one you really use. As it was too late to remove the mistaken one now that I had coded it all, I decided to let it into BLH (as the second mode). Your mode will be the third one.
sje wrote: 1) The buttons on the board display could use color instead of 0/1 digit labels. Say, dark gray for on/1 and light gray for off/0. OR maybe use both digit and color at the same time.

2) Have three bitboard displays and an operator button array. The user can set the entries in the first two bitboards, select an operator button (or/and/xor/comp-and/shift/etc.), and then see the result in the third bitboard.
1) sadly, Windows' themes doesn't allow to change the color of the buttons. I think I could bypass this limitation by deriving my own button class, but that would be too much a big job for such a small project. :)

2) done.
sje wrote:Also, although this would require a lot of work, the application could accept a FEN string and allow the user to select bitboard displays of various occupancy and attack bitboards.
I toyed a bit with this idea, as this screenshot shows :
Image
but I wasn't satisfied with how bloated my "small" tool would become, plus it really didn't match my needs. That wouldn't be too much work, actually, as I yet have a fen parser in Prédateur and could also copy/paste its move generator code. Still, I just removed this functionality to go back to my own vision of the ideal tool. :)
"The only good bug is a dead bug." (Don Dailey)
[Blog: http://tinyurl.com/predateur ] [Facebook: http://tinyurl.com/fbpredateur ] [MacEngines: http://tinyurl.com/macengines ]
User avatar
Giorgio Medeot
Posts: 52
Joined: Fri Jan 29, 2010 2:01 pm
Location: Ivrea, Italy

Re: Bitboards' Little Helper (New free tool)

Post by Giorgio Medeot »

Really nice! :)
And now I can let my laziness rest... :D

Again, thank you: I will keep it in my tool box, from now on.

Cheers,
  • Giorgio
wgarvin
Posts: 838
Joined: Thu Jul 05, 2007 5:03 pm
Location: British Columbia, Canada

Re: Bitboards' Little Helper (New free tool)

Post by wgarvin »

There's 8 plausible orderings for the squares within a bitboard (four with ranks in each byte, and four with files in each byte). Its probably not worth the effort to support them all, though. But if you wanted to, then you could change those radio buttons for a combo box.
sluijten
Posts: 44
Joined: Wed Apr 13, 2011 12:43 pm

Re: Bitboards' Little Helper (New free tool)

Post by sluijten »

Great tool! Can you add multiplication (to visualize how magics work)?
User avatar
JuLieN
Posts: 2949
Joined: Mon May 05, 2008 12:16 pm
Location: Bordeaux (France)
Full name: Julien Marcel

Re: Bitboards' Little Helper (New free tool)

Post by JuLieN »

sluijten wrote:Great tool! Can you add multiplication (to visualize how magics work)?
Hello Stef :) I'm currently in the process of adding shifts and rotations, so I'd gladly add "multiplications" as well... providing you tell me what it is exactly, as I don't know how magic bitboards work. Is it a normal "1st bitboard" x "2nd bitboard" multiplication? (like b00001000 x b00000101 = b00101000 ?)
"The only good bug is a dead bug." (Don Dailey)
[Blog: http://tinyurl.com/predateur ] [Facebook: http://tinyurl.com/fbpredateur ] [MacEngines: http://tinyurl.com/macengines ]
sluijten
Posts: 44
Joined: Wed Apr 13, 2011 12:43 pm

Re: Bitboards' Little Helper (New free tool)

Post by sluijten »

JuLieN wrote:(...) Is it a normal "1st bitboard" x "2nd bitboard" multiplication? (like b00001000 x b00000101 = b00101000 ?)
Yes, that's correct, in decimal: 8 * 5 = 40
Overflow bits are just discarded. Thanks!
Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: Bitboards' Little Helper (New free tool)

Post by Gerd Isenberg »

sluijten wrote:Great tool! Can you add multiplication (to visualize how magics work)?
It is interesting to multiply ranks or diagonals (or their subsets) with the lowest file 0x0101010101010101. Unlike this fill-north kindergarten multiplication, magic bitboards in general have no fixed one-to-one mapping of occupied bits to the upper result bits of the product while varying the occupancy - due to "random" intermediate overflows, which makes it hard to visualize how magic bitboards work.
User avatar
JuLieN
Posts: 2949
Joined: Mon May 05, 2008 12:16 pm
Location: Bordeaux (France)
Full name: Julien Marcel

Re: Bitboards' Little Helper (New free tool)

Post by JuLieN »

Gerd Isenberg wrote:
sluijten wrote:Great tool! Can you add multiplication (to visualize how magics work)?
It is interesting to multiply ranks or diagonals (or their subsets) with the lowest file 0x0101010101010101. Unlike this fill-north kindergarten multiplication, magic bitboards in general have no fixed one-to-one mapping of occupied bits to the upper result bits of the product while varying the occupancy - due to "random" intermediate overflows, which makes it hard to visualize how magic bitboards work.
Well, then I can see no practical way to integrate all this into a general tool while keeping the interface simple, so I'll pass on multiplications until I figure out an elegant way to do it, sorry. :?
"The only good bug is a dead bug." (Don Dailey)
[Blog: http://tinyurl.com/predateur ] [Facebook: http://tinyurl.com/fbpredateur ] [MacEngines: http://tinyurl.com/macengines ]
Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: Bitboards' Little Helper (New free tool)

Post by Gerd Isenberg »

JuLieN wrote:
Gerd Isenberg wrote:
sluijten wrote:Great tool! Can you add multiplication (to visualize how magics work)?
It is interesting to multiply ranks or diagonals (or their subsets) with the lowest file 0x0101010101010101. Unlike this fill-north kindergarten multiplication, magic bitboards in general have no fixed one-to-one mapping of occupied bits to the upper result bits of the product while varying the occupancy - due to "random" intermediate overflows, which makes it hard to visualize how magic bitboards work.
Well, then I can see no practical way to integrate all this into a general tool while keeping the interface simple, so I'll pass on multiplications until I figure out an elegant way to do it, sorry. :?
You may still implement multiplication, and also division and modulo. The implementation should be as simple as bitwise boolean. An additional column of arithmetical operators (+-*/%). Their application is a bit limited for visualization purposes, but there are some exceptions, i.e. (-1)/3 and that like, and the mentioned kindergarten multiplication. On a chessboard, one starts seeing and feeling numbers in an other way ;-)

Code: Select all

Diagonal         *  B-File
. . . . . . . 1     . 1 . . . . . .     . 1 1 1 . 1 1 1
. . . . . . 1 .     . 1 . . . . . .     . 1 1 1 . 1 1 1
. . . . . 1 . .     . 1 . . . . . .     . 1 1 1 . 1 1 .
. . . . 1 . . .     . 1 . . . . . .     . 1 1 1 . 1 . .
. . . . . . . .  *  . 1 . . . . . .  =  . 1 1 1 . . . .
. . 1 . . . . .     . 1 . . . . . .     . 1 1 1 . . . .
. 1 . . . . . .     . 1 . . . . . .     . 1 1 . . . . .
1 . . . . . . .     . 1 . . . . . .     . 1 . . . . . .
User avatar
nanochess
Posts: 64
Joined: Thu Feb 19, 2009 5:34 pm
Location: Mexico, Mexico

Re: Bitboards' Little Helper (New free tool)

Post by nanochess »

What a great idea and pretty nice tool :)

A year ago I was playing with bitboards and I managed to do a mistake that I couldn't find by eye until a week later, this tool would have saved me a lot of time.

Good work :D
All good things are difficult to achieve.
Toledo Nanochess book http://www.amazon.com/Toledo-Nanochess- ... 1304864375