Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132940 views
License: OTHER
1
unsigned int getFirstIndex(char board[BOARD_WIDTH][BOARD_HEIGHT]) {
2
unsigned int index = 0;
3
for (int x=0; x<BOARD_WIDTH; x++) {
4
for (int y=0; y<BOARD_HEIGHT; y++) {
5
index += charToInt(board[x][y])*myPow(3, ((x+y*BOARD_WIDTH)%HASH_MODULO));
6
}
7
}
8
index = index % MAXIMUM_SITUATIONS;
9
return index;
10
}
11
12