opti but not sure if it's enought

This commit is contained in:
Théophyl Hoguet committed 2022-03-10 12:46:01 +01:00
1 parent 0998257121
commit d24197bc3d
3 files changed
+16 -1

No files matched your search

+6
View File
@@ -7,6 +7,12 @@ unsigned int max(unsigned int a, unsigned int b) {
return b;
}
unsigned int min(unsigned int a, unsigned int b) {
if (a < b)
return a;
return b;
}
void checkPointer(void* p, char* errMessage) {
if (!p) {
fprintf(stderr, "%s", errMessage);
+9
View File
@@ -21,6 +21,15 @@ struct game_s {
*/
unsigned int max(unsigned int a, unsigned int b);
/**
* @brief return the min between a and b
*
* @param a uint to test
* @param b uint to test
* @return the min between a and b
*/
unsigned int min(unsigned int a, unsigned int b);
/**
* @brief check if the pointer is NULL fprinf and exit else nothing
*
+1 -1
View File
@@ -502,7 +502,7 @@ uint game_nb_solutions(cgame g) {
uint nb_blank_cases = total_number_of_blank_cases(copy_g);
uint alreadyDone[nb_blank_cases * 2];
// else try brutforce with deepness going from 1 to the total number of blank cases on the game
for (uint deep = 1; deep < nb_blank_cases; deep++) {
for (uint deep = min(game_nb_rows(copy_g), game_nb_cols(copy_g)); deep < nb_blank_cases; deep++) {
aux_game_solve(copy_g, deep, &move_played, alreadyDone, 0, nb_blank_cases * 2, true, &nb_solutions, &t_games, &size);
}
for (uint i = 0; i < nb_solutions; i++) {