printboard

This commit is contained in:
Lorenzo Bianchi 2023-05-17 15:15:02 +02:00
parent bd08db380d
commit 87af494b2c
3 changed files with 13 additions and 1 deletions

View File

@ -10,4 +10,8 @@
che fa gia il controllo (ha come svantaggio che non puoi specifare dove va in errore con l'errexit)
(anche se forse basta passare la/le stringe ma vedi riga 3)
- killare il server deve uccidere i figli
- killare il server deve uccidere i figli
- isValid è corretto?
- getIndex con define?

View File

@ -26,5 +26,6 @@ int checkWinAll(tile_t *board);
void printBoard(tile_t *board);
void printTile(tile_t t);
int getHeight(tile_t *board, int col);
#endif

View File

@ -105,4 +105,11 @@ void printTile(tile_t t){
printf("\033[91m%c\033[39m", _TOKEN2);
break;
}
}
int getHeight(tile_t *board, int col){
int height = _ROWS - 1;
while (height-- >= 0 && board[getIndex(height, col)] == EMPTY);
return height;
}