checkWinAll
This commit is contained in:
parent
878c29c764
commit
d4a77602ee
|
@ -7,6 +7,8 @@ static int col;
|
|||
|
||||
void setCollums(int collums);
|
||||
int getIndex(int i, int j);
|
||||
|
||||
tile_t checkWin(tile_t *board, int pos, int rows, int collums);
|
||||
tile_t checkWinAll(tile_t *board, int rows, int collums);
|
||||
|
||||
#endif
|
10
src/forza4.c
10
src/forza4.c
|
@ -64,5 +64,15 @@ tile_t checkWin(tile_t *board, int pos, int rows, int collums) {
|
|||
}
|
||||
}
|
||||
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
tile_t checkWinAll(tile_t *board, int rows, int collums){
|
||||
for (int i=0; i<rows*collums; i++) {
|
||||
if (checkWin(board, i, rows, collums) != EMPTY) {
|
||||
return checkWin(board, i, rows, collums);
|
||||
}
|
||||
}
|
||||
|
||||
return EMPTY;
|
||||
}
|
Loading…
Reference in New Issue