2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/presentations/Programmieren-Tutorium/Tutorium-11/vierGewinnt.c
2013-11-05 19:39:03 +01:00

10 lines
344 B
C

unsigned int getFirstIndex(char board[BOARD_WIDTH][BOARD_HEIGHT]) {
unsigned int index = 0;
for (int x=0; x<BOARD_WIDTH; x++) {
for (int y=0; y<BOARD_HEIGHT; y++) {
index += charToInt(board[x][y])*myPow(3, ((x+y*BOARD_WIDTH)%HASH_MODULO));
}
}
index = index % MAXIMUM_SITUATIONS;
return index;
}