This repository has been archived on 2026-10-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
lightup/game_private.c
Theophyl Hoguet 05bd0e2a97 Merge branch 'main' into 'sound_effects_game_sdl'
# Conflicts:
#   .vscode/settings.json
#   model.c
2022-03-21 20:47:47 +00:00

56 lines
903 B
C

#include "game_private.h"
#include <stdio.h>
#include <stdlib.h>
#include "game.h"
#include "game_ext.h"
uint max(uint a, uint b) {
if (a > b)
return a;
return b;
}
uint min(uint a, uint b) {
if (a < b)
return a;
return b;
}
int int_min(int a, int b) {
if (a < b)
return a;
return b;
}
void checkPointer(void* p, char* errMessage) {
if (!p) {
fprintf(stderr, "%s", errMessage);
exit(EXIT_FAILURE);
}
}
void test_output(int i, int excepted, char* message) {
if (i != excepted) {
fprintf(stderr, "%s", message);
exit(EXIT_FAILURE);
}
}
uint get_nb_char_from_int(uint number) {
uint res = 0;
do {
res++;
number = number / 10;
} while (number != 0);
return res;
}
bool game_has_error_general(cgame g) {
for (uint i = 0; i < game_nb_rows(g); i++) {
for (uint j = 0; j < game_nb_cols(g); j++) {
if (game_has_error(g, i, j))
return true;
}
}
return false;
}