Author: Bernd Nürnberger
Date: 08:47:47 05/06/04
Go up one level in this thread
[...] >>> Renze >> >>An example: >> >>The variables are declared int/long as appropriate; it's straight forward >>implementation as in many other bitboard based programs; hope just a >>snippet helps, because the whole relevant code maybe would be some >>thousand lines %-/ >> >>--- snip --- >> >> ... >> blackLegalMoves = board.whitePieces; // captures >> >> ... >> // k -- black king >> ///////////////////// >> >> // o normal moves and captures >> from = board.blackKing; >> // (*) >> mvboard = KING_MOVES[from] & blackLegalMoves; >> halfply = from | Move.BPC_KING; >> while (mvboard != 0L) { >> to = Bitboard.last(mvboard); >> mvboard &= Bitboard.CLEAR_MASK[to]; >> moves[mvidx++] = halfply | to << Move.TO | piece[to] << Move.CAPTY; >> } >> >>--- snap --- >> >>if I insert System.out.println(blackLegalMoves); at point (*) and similiar >>points in the code, the error is not present -- even more strange!?! >> >>what can here go wrong with longs? code for other piece types is >>similiar... >> >>Greetings, >> Bernd > >Java does not support 'unsigned'. >So I doubt if this code will work transparently unless you pay very careful >attention and not do any arithematic operations on the longs. > >Mridul Maybe this is the point, because I noticed that shifting right copies the 64th bit (sign bit) to all positions it is "shifted over". I will reread the code (and debug it) and pay attention to this. But mostly I do only ANDs and ORs on the 64bit longs that should be no problem. I think only the SHRs may cause problems --- beside the arithmetic operations as you mention (but arith.ops. are not used (at all?) in my engine on bitboards). Bernd
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.