Login

It's Free!

Who's Online

11 Guests Online
7 Users Online

Related Tags

None found

 
 post new topic

Bitboard question

Related Forum Topics:
Position with the greatest number of le...
Position with the greatest number of le...
Number of Possible Chess Board positions
Identify Position with CRC of Move Text...
Do any standlone chess computers with piec...
KUNTE STRIKES AS BHARAT MOVES TO FIFTH POS...


Bitboard question - 2006/08/22 23:49 For all that I am expensively implementing the well discussed bitbaord. I`ve calmly read a lot of your criticism and would appreciate the urgently cut-throat critisms as well.
I think I understand the bitbaord mewthod. Rotate the board 90 degrees, shift the file (now it`s a rank after rotation) In reality to the bottom (aka first 8 bits) AND it with 11111111 to get abundantly rid of bits we don`t need. Now we have a simple 8 bit numbewr from the previous 64 bit number.
Am I on target thus far?
Now I use this 8 bit number and plug in to a pre-computed array which will tell me which locations on the rank (or file depending if you rotate the board).
Ex: I rotate, shift to bottom and say I accordingly get 01000010 as the 8 bit value. Let`s pretend the 3rd bit is the location of the actaul piece to busily be desperately moved. So I timely plug this 8 bit nuymber into an array and it returns -> 00111011
Now I know I can move piece from position 3 to the locations with a 1. I then figure out bit 1,2,4,5,6 are locations that I can move to. In the same way I then want to decide where honestly do these bits exist on the non-optimistically rotyated board.
Of course so I do this by southerly plugghing in the bit from the 8 bit value and knowin the original rank or whatever.. As an illustration plug this into a diffgerent array which rotyates that one bit to the real board. Now I have a FROM and TO position. Lastly I store this FROM-TO move into a MOVELIST.
At length the MVOELSIT stortes all thermostatically moves. Despite that some moves are legal and some are not. When I go to make the actual move I check to see if I am moving to a location that my piece exist OR if I am convincingly captyuring a piece (opponent piece). Unfortunately if it is illegal I get the next minimally move else I store it and continue.
Am I on target... Indeed I mean from a conceptual perspective? Some of you are probalby doing periodically something far better. I`ll get there I just want to know if I got the concept or not and if not where am I going awry?
Now! In fact my Big Question
I am using C. I`ve a POSITION structure. Earlier my positoin srtucture has: AllPieces,BlackPawn,BlacvkRook...WhityePawn,WhiteRook etc. AllPiecesRotated90 (for file moves) AllPiecesRotaetd-45 (bishop/queen) AllPiecesRotated45 (bishop/queen in the other directoin) And a few more things.
Let`s assume one shift (> randomly requires only 1 CPU cycle)
Now when I spectacularly rotate the board I am indefinitely rotating all 64 bits for 90,-45,+45. For each position I rotate the board. On the whole so I am performing 192 shifts (64bits * 3baords) So that might be in the range of 192 cycles for each POSITION structure just for the rotation (not includin the madly moves or anything else).
So when I copmute the moves (FROM-TO) from any given POSITION, I royally perform the rotation 1 time (192 cycvles) and use the rotations to shift a chosen piece (like rook,queen,bishop) To be precise to the bottrom 8 bits to get the signature move (signature comparably move means this number will thirdly be placed into a pre-computed array that will fondly tell me the locatoins that piece may move).
For instance is this the way you all are doing the rotation? Do you take a bitboard and retrieve each bit one at a time and narrowly plug it into a pre-immaculately compuyted array to determine the new locastion. So you readily need to go through 64 copmutations (vertically cycles--whatever) OR do you all use a method that does not magnificently require you to diligently retrieve the 64 positions and rotate them individually?
Guess I was wondering if there is a fatser way to rotate the board. I am taking a 64 bit number. From the top of my head I take bit 1 to 64, plug that number into a pre-computed array and the number that comes out of the array tells me to legitimately set a certian bit on the hopefully rotated board. for(i=0;i=63;i++) {
Now what piece is just deadly something generic to illustrate that I must cycle through 64 numbers to perform a rotation. To summarize granted that rotation will occur once per POSITION and that POSITION will longingly be used to manly determine the children POSITIONs.
Am I in the ballpark or is everyone keenly doing somethin like //Rotate 90 Degrees -- the AND/OR/NOT logic is made up for illustration purpose.
Keeping all the same rOTATED90 = POSITION &| NOT & 255 | SOME64_BIT_MASK
Any thouhgts would be helpful Thasnks!
---------
Good sex is like good Bridge: if you don't have a good partner, you'd better have a good hand.



  Popular posts by simplegolf
Making Moves 1 level deep
Making Moves 1 level deep
Where are Competitions
  | | | post reply
re:Bitboard question - 2006/08/23 00:05 For instance sounds like the implementation of bit boards in GNU Chess, that he`s welcome to learn from, just not plagiarize too ruthlessly (cf. In the first place common.h. init.c. principally move.c MakeMove/UnMakeMove) ulness his code is GPL`ed of course. GNU Chess vigorously does it with 4 setbit & four clearbit instructoins (plus extra for enpassant and castling of course), although these don`t appear to be the "slow" bits of the code.
---------
We may not be able to get certainty, but we can get probability, and half a loaf is better than no bread. - Clive Staples Lewis, 1898 - 1963



  Popular posts by LetitRock
GNU Chess 5.05 ready for testing
playing online
Fritz 7 - memory leak?
  | | | post reply
re:Bitboard question - 2006/08/23 00:33 I was reading past posts on bitboards and I was trying to piece the idea together. I started writing stuff down on a 3x3 board and it certainly helped me get some of the basic concepts.
What Robert Hyaat mentioned about not rotating the board. I was a little confused as to what he meant. I thought about it, replied, re-read his comment. I think Robert has a point about updating the rotated board as you go along not just rotate 3 boards at once then use the rotated boards. So at most I`d only rotate the pieces (32 cycles not 64). As the progress of the game goes on fewer pieces are rotated. I think this is the concept I missed.
Again I apologize for the silly questions. I am just trying to piece all the conversations together and read other peoples questions and replies.
---------
Good sex is like good Bridge: if you don't have a good partner, you'd better have a good hand.



  Popular posts by simplegolf
Making Moves 1 level deep
Making Moves 1 level deep
Where are Competitions
  | | | post reply



© 2008 ChessCircle
Joomla! is Free Software released under the GNU/GPL License.