by matrix101 » 26 Apr 2014, 11:19
For a standard board definition, I would need to use integer variables to receive data from #include "bitboard.h" for example.
I would start like:
void init_board()
{
for (int r = 0; r < 8; ++i)
{
for (int c = 0; c < 8; ++i)
{
board[s] = AVAILABLE;
}
}
#ifndef _BOARD_H
#define _BOARD_H
#include "bitboard.h"
static int done_init = 0;
const CACHE_ALIGN uint64 Bitboard::mask[64] =
{
1,
((uint64)1) << 1,
((uint64)1) << 2,
((uint64)1) << 3,
((uint64)1) << 4,
((uint64)1) << 5,
((uint64)1) << 6,
((uint64)1) << 7,
((uint64)1) << 8,
((uint64)1) << 9,
((uint64)1) << 10,
((uint64)1) << 11,
((uint64)1) << 12,
((uint64)1) << 13,
((uint64)1) << 14,
((uint64)1) << 15,
((uint64)1) << 16,
((uint64)1) << 17,
((uint64)1) << 18,
((uint64)1) << 19,
((uint64)1) << 20,
((uint64)1) << 21,
((uint64)1) << 22,
((uint64)1) << 23,
((uint64)1) << 24,
((uint64)1) << 25,
((uint64)1) << 26,
((uint64)1) << 27,
((uint64)1) << 28,
((uint64)1) << 29,
((uint64)1) << 30,
((uint64)1) << 31,
((uint64)1) << 32,
((uint64)1) << 33,
((uint64)1) << 34,
((uint64)1) << 35,
((uint64)1) << 36,
((uint64)1) << 37,
((uint64)1) << 38,
((uint64)1) << 39,
((uint64)1) << 40,
((uint64)1) << 41,
((uint64)1) << 42,
((uint64)1) << 43,
((uint64)1) << 44,
((uint64)1) << 45,
((uint64)1) << 46,
((uint64)1) << 47,
((uint64)1) << 48,
((uint64)1) << 49,
((uint64)1) << 50,
((uint64)1) << 51,
((uint64)1) << 52,
((uint64)1) << 53,
((uint64)1) << 54,
((uint64)1) << 55,
((uint64)1) << 56,
((uint64)1) << 57,
((uint64)1) << 58,
((uint64)1) << 59,
((uint64)1) << 60,
((uint64)1) << 61,
((uint64)1) << 62,
((uint64)1) << 63
};
int Bitboard::MagicTable32[32];#if defined(_64BIT)
int Bitboard::MagicTable64[64];
#endif
static const int magicTable[64] = {
0, 1,48, 2,57,49,28, 3,
61,58,50,42,38,29,17, 4,
62,55,59,36,53,51,43,22,
45,39,33,30,24,18,12, 5,
63,47,56,27,60,41,37,16,
54,35,52,21,44,32,23,11,
46,26,40,15,34,20,31,10,
25,14,19, 9,13, 8, 7, 6,
};
int board[64];
int distance[64][64];
int zobristKeys[12][64];
int* pBoard = malloc(sizeof(int) * 64);
int* pboard = new int[64];
for (int sq = 0; sq < 64; ++sq)
pboard[sq] = board[sq]; // in C/C++ identical to *(pboard + sq) = board[sq];
...
delete[] pboard;
Now these integrer variables in my code reserve memory location eg squares? I have defined bitboard.h,magicboard.h and board.h with include# and then used them in the rest of the code.
Would there be a possibility that my above-posted code would ever work?