G
george r smith
Hi all,
Need some help on a C# problem.
Playing with chess stuff - great fun to learn with.
int sq;
sq = 0;
UInt64 bb = 0;
sq = 1;
bb |= (1ul << sq);
sq = 6;
bb |= (1ul << sq);
sq = 57;
bb |= (1ul << sq);
sq = 62;
bb |= (1ul << sq);
Console.WriteLine(bb); // this prints 4,755,801,206,503,243,842
Now we have this ulong (UInt64) that has the following values in binary,hex
and decimal:
01000010 00000000 00000000 00000000 00000000 00000000 00000000 01000010
42 00 00 00 00 00 00 42
4,755,801,206,503,243,842
I know that it might not be the best way to go about chess programming but
what I want to do is to convert this ulong bb into either a regular array
using
(byte[] aByteArray = new byte[64])
or
a BitArray using (BitArray aBitArray = new BitArray(64).
Will someone please show me the way.
Thanks
grs
Need some help on a C# problem.
Playing with chess stuff - great fun to learn with.
int sq;
sq = 0;
UInt64 bb = 0;
sq = 1;
bb |= (1ul << sq);
sq = 6;
bb |= (1ul << sq);
sq = 57;
bb |= (1ul << sq);
sq = 62;
bb |= (1ul << sq);
Console.WriteLine(bb); // this prints 4,755,801,206,503,243,842
Now we have this ulong (UInt64) that has the following values in binary,hex
and decimal:
01000010 00000000 00000000 00000000 00000000 00000000 00000000 01000010
42 00 00 00 00 00 00 42
4,755,801,206,503,243,842
I know that it might not be the best way to go about chess programming but
what I want to do is to convert this ulong bb into either a regular array
using
(byte[] aByteArray = new byte[64])
or
a BitArray using (BitArray aBitArray = new BitArray(64).
Will someone please show me the way.
Thanks
grs