void InitializeGame() { int i, piecesPerBin, *arrayBoard; arrayBoard = (int *) SafeMalloc ((boardSize+1) * sizeof (int)); UpdateGameSpecs(); generic_hash_destroy(); SetupTierStuff(); piecesPerBin = numOfPieces / (boardSize - 2); for(i = 0; i < boardSize; i += 1) { arrayBoard[i] = piecesPerBin; } arrayBoard[mancalaL] = 0; arrayBoard[mancalaR] = 0; arrayBoard[turn] = 0; /* this is the max number the rearrangerHash can generate given the limitations of the 32-bit cpu 2 * (31 my_nCr 15) */ //gNumberOfPositions = 601080390; gInitialPosition = array_unhash(arrayBoard); //int z; // for(z = 0;z < boardSize + 1; z++) // printf("slot %d: %d\n",z,arrayBoard[z]); SafeFree (arrayBoard); gMoveToStringFunPtr = MoveToString; }
void SetupGame() { generic_hash_destroy(); SetupTierStuff(); if (width < 5 && length < 5) { int pieces_array[10] = {BLACK, 0, (boardsize+1)/2, WHITE, 0, boardsize/2, SPACE, 0, boardsize, -1}; gNumberOfPositions = generic_hash_init(boardsize, pieces_array, NULL, 0); // initial position int i; char* initial = (char *) SafeMalloc(boardsize * sizeof(char)); for(i = 0; i < boardsize; i++) initial[i] = SPACE; gInitialPosition = hash(initial, 1); } }
static void callee_info_table_destroy(void) { callee_info_table_exit = true; generic_hash_destroy(GLOBAL_DCONTEXT, callee_info_table); }