autosave just in case something goes sideways
This commit is contained in:
parent
57eb465d91
commit
6018db54d8
126
algorithm.c
126
algorithm.c
|
@ -1,5 +1,9 @@
|
||||||
#include "display.c"
|
#include "display.c"
|
||||||
|
|
||||||
|
bool is_equal_date(date d1, date d2) {
|
||||||
|
return (d1.hour == d2.hour && d1.day == d2.day && d2.month == d1.month && d2.year == d1.year);
|
||||||
|
}
|
||||||
|
|
||||||
int get_date_index(creneau* edt, int len_creneau, date d) {
|
int get_date_index(creneau* edt, int len_creneau, date d) {
|
||||||
// could be done in log(n), I know
|
// could be done in log(n), I know
|
||||||
// yields the 1st occurence of d in edt
|
// yields the 1st occurence of d in edt
|
||||||
|
@ -52,8 +56,10 @@ int get_fst_offset(creneau* edt, date d) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
|
bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
|
||||||
|
bool debug = false;
|
||||||
|
|
||||||
/* conditions (AND) :
|
/* conditions (AND) :
|
||||||
|
0) Only 1 colle at a time
|
||||||
1) Alternate between physics and english
|
1) Alternate between physics and english
|
||||||
2) Pattern for math colles is exactly 3-1-3-1-...
|
2) Pattern for math colles is exactly 3-1-3-1-...
|
||||||
3) Between 1 and 2 colles per week and per group (exclusing special colles such as Info)
|
3) Between 1 and 2 colles per week and per group (exclusing special colles such as Info)
|
||||||
|
@ -65,7 +71,32 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int offs = get_date_index(edt, len_edt, end);
|
||||||
|
|
||||||
//printf("EndId : %d\n", end_id);
|
//printf("EndId : %d\n", end_id);
|
||||||
|
// 0)
|
||||||
|
int id = 1;
|
||||||
|
while(id >= 0 && id < len_edt && is_equal_date(edt[offs+id].date, end)) {
|
||||||
|
if(str_equal(edt[offs+id].name, edt[offs].name)) {
|
||||||
|
if(debug) {
|
||||||
|
printf("Unable to duplicate colleur %s\n", edt[offs].name);
|
||||||
|
}
|
||||||
|
stats[0]++;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
id++;
|
||||||
|
}
|
||||||
|
id = -1;
|
||||||
|
while(id >= 0 && id < len_edt && is_equal_date(edt[offs+id].date, end)) {
|
||||||
|
if(str_equal(edt[offs+id].name, edt[offs].name)) {
|
||||||
|
if(debug) {
|
||||||
|
printf("Unable to duplicate colleur %s\n", edt[offs].name);
|
||||||
|
}
|
||||||
|
stats[0]++;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
id--;
|
||||||
|
}
|
||||||
|
|
||||||
// 1) PC/AGL alternance
|
// 1) PC/AGL alternance
|
||||||
|
|
||||||
|
@ -73,18 +104,27 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
|
||||||
int pc = 0;
|
int pc = 0;
|
||||||
char has_to_be = 'n'; // 'n' = not set, 'a' = AGL and 'p' = PC
|
char has_to_be = 'n'; // 'n' = not set, 'a' = AGL and 'p' = PC
|
||||||
for(int i = end_id-1; i >= 0; i--) {
|
for(int i = end_id-1; i >= 0; i--) {
|
||||||
if(i == 0 || (date_dist(edt[0].date, edt[i].date)%7 == 4 && date_dist(edt[0].date, edt[i+1].date)%7 != 4)) {
|
if(i != end_id-1 && (i == 0 || (date_dist(edt[0].date, edt[i].date)%7 == 4 && date_dist(edt[0].date, edt[i+1].date)%7 != 4))) {
|
||||||
//printf("Checking AGL/PC...\n");
|
//printf("Checking AGL/PC...\n");
|
||||||
// currently pointed date is the last friday of the week
|
// currently pointed date is the last friday of the week
|
||||||
// since we are going down, friday <==> reset variables and check for conflicts
|
// since we are going down, friday <==> reset variables and check for conflicts
|
||||||
if(agl + pc != 1) {
|
if(agl + pc != 1) {
|
||||||
|
if(debug) {
|
||||||
printf("Missing english or physics colle at index %d for group %d (found %d)\n", i, grp, agl+pc);
|
printf("Missing english or physics colle at index %d for group %d (found %d)\n", i, grp, agl+pc);
|
||||||
|
}
|
||||||
|
stats[1]++;
|
||||||
return false;
|
return false;
|
||||||
} else if(has_to_be == 'p' && pc != 1) {
|
} else if(has_to_be == 'p' && pc != 1) {
|
||||||
|
if(debug) {
|
||||||
printf("Wrong number of physics colle at index %d for group %d\n", i, grp);
|
printf("Wrong number of physics colle at index %d for group %d\n", i, grp);
|
||||||
|
}
|
||||||
|
//stats[1]++;
|
||||||
return false;
|
return false;
|
||||||
} else if(has_to_be == 'a' && agl != 1) {
|
} else if(has_to_be == 'a' && agl != 1) {
|
||||||
|
if(debug) {
|
||||||
printf("Wrong number of english colle at index %d for group %d\n", i, grp);
|
printf("Wrong number of english colle at index %d for group %d\n", i, grp);
|
||||||
|
}
|
||||||
|
//stats[1]++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(has_to_be == 'n') {
|
if(has_to_be == 'n') {
|
||||||
|
@ -115,16 +155,25 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
|
||||||
for(int i = end_id-1; i >= 0; i--) {
|
for(int i = end_id-1; i >= 0; i--) {
|
||||||
if(i == 0 || (date_dist(edt[0].date, edt[i].date)%7 == 4 && date_dist(edt[0].date, edt[i+1].date)%7 != 4)) {
|
if(i == 0 || (date_dist(edt[0].date, edt[i].date)%7 == 4 && date_dist(edt[0].date, edt[i+1].date)%7 != 4)) {
|
||||||
if(math != 0 && math != 1) {
|
if(math != 0 && math != 1) {
|
||||||
|
if(debug) {
|
||||||
printf("Invalid number of math colles at index %d for group %d\n", i, grp);
|
printf("Invalid number of math colles at index %d for group %d\n", i, grp);
|
||||||
|
}
|
||||||
|
stats[2]++;
|
||||||
return false;
|
return false;
|
||||||
} else if(math == 0) {
|
} else if(math == 0) {
|
||||||
if(last_no_math != -1 && last_no_math != 3) {
|
if(last_no_math != -1 && last_no_math != 3) {
|
||||||
|
if(debug) {
|
||||||
printf("Invalid rotation of math colles at index %d for group %d\n", i, grp);
|
printf("Invalid rotation of math colles at index %d for group %d\n", i, grp);
|
||||||
|
}
|
||||||
|
stats[2]++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
last_no_math = 0;
|
last_no_math = 0;
|
||||||
} else if(last_no_math > 3) {
|
} else if(last_no_math > 3) {
|
||||||
|
if(debug) {
|
||||||
printf("Too many math colles at index %d for group %d\n", i, grp);
|
printf("Too many math colles at index %d for group %d\n", i, grp);
|
||||||
|
}
|
||||||
|
stats[2]++;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if(last_no_math != -1) {
|
if(last_no_math != -1) {
|
||||||
|
@ -143,7 +192,10 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
|
||||||
for(int i = end_id-1; i >= 0; i--) {
|
for(int i = end_id-1; i >= 0; i--) {
|
||||||
if(i == 0 || (date_dist(edt[0].date, edt[i].date)%7 == 4 && date_dist(edt[0].date, edt[i+1].date)%7 != 4)) {
|
if(i == 0 || (date_dist(edt[0].date, edt[i].date)%7 == 4 && date_dist(edt[0].date, edt[i+1].date)%7 != 4)) {
|
||||||
if(n_colles != 1 && n_colles != 2) {
|
if(n_colles != 1 && n_colles != 2) {
|
||||||
|
if(debug) {
|
||||||
printf("Invalid number of colles at index %d for group %d (found %d)\n", i, grp, n_colles);
|
printf("Invalid number of colles at index %d for group %d (found %d)\n", i, grp, n_colles);
|
||||||
|
}
|
||||||
|
stats[3]++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
n_colles= 0;
|
n_colles= 0;
|
||||||
|
@ -159,12 +211,18 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) {
|
||||||
for(int i = end_id-1; i >= 0; i--) {
|
for(int i = end_id-1; i >= 0; i--) {
|
||||||
if(i == 0 || (date_dist(edt[0].date, edt[i].date)%7 == 4 && date_dist(edt[0].date, edt[i+1].date)%7 != 4)) {
|
if(i == 0 || (date_dist(edt[0].date, edt[i].date)%7 == 4 && date_dist(edt[0].date, edt[i+1].date)%7 != 4)) {
|
||||||
if(inf != 0 && inf != 1) {
|
if(inf != 0 && inf != 1) {
|
||||||
|
if(debug) {
|
||||||
printf("Invalid number of info colles at index %d for group %d\n", i, grp);
|
printf("Invalid number of info colles at index %d for group %d\n", i, grp);
|
||||||
|
}
|
||||||
|
stats[4]++;
|
||||||
return false;
|
return false;
|
||||||
} else if(inf == 0) {
|
} else if(inf == 0) {
|
||||||
last_no_inf = 0;
|
last_no_inf = 0;
|
||||||
} else if(last_no_inf > 5) {
|
} else if(last_no_inf > 5) {
|
||||||
|
if(debug) {
|
||||||
printf("Too few info colles at index %d for group %d\n", i, grp);
|
printf("Too few info colles at index %d for group %d\n", i, grp);
|
||||||
|
}
|
||||||
|
stats[4]++;
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if(last_no_inf != -1) {
|
if(last_no_inf != -1) {
|
||||||
|
@ -312,10 +370,6 @@ int heuristique_MP2I(creneau* edt,int len_edt, int grp, date end) {
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_equal_date(date d1, date d2) {
|
|
||||||
return (d1.hour == d2.hour && d1.day == d2.day && d2.month == d1.month && d2.year == d1.year);
|
|
||||||
}
|
|
||||||
|
|
||||||
// typedef struct colleur {char* name; int namelen; topic mat; date* disp; int n_disp;} colleur;
|
// typedef struct colleur {char* name; int namelen; topic mat; date* disp; int n_disp;} colleur;
|
||||||
colleur* get_colleurs(colleur* cl, int len_cl, date d, int* how_many) {
|
colleur* get_colleurs(colleur* cl, int len_cl, date d, int* how_many) {
|
||||||
colleur* res = malloc(sizeof(colleur)*20); // max. 3 colles per creneau
|
colleur* res = malloc(sizeof(colleur)*20); // max. 3 colles per creneau
|
||||||
|
@ -341,13 +395,21 @@ colleur* get_colleurs(colleur* cl, int len_cl, date d, int* how_many) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_arr(int* arr, int len) {
|
||||||
|
printf("[");
|
||||||
|
for(int i = 0; i < len; i++) {
|
||||||
|
printf("%d ", arr[i]);
|
||||||
|
}
|
||||||
|
printf("]\n");
|
||||||
|
}
|
||||||
|
|
||||||
void aux(int* weeks_len, creneau* edt, int len_edt, colleur* chads, int n_chads, int n_groups, int n_weeks, int current_grp, int current_week, int current_offset, int starting_group, bool is_first) {
|
void aux(int* abort, int* weeks_len, creneau* edt, int len_edt, colleur* chads, int n_chads, int n_groups, int n_weeks, int current_grp, int current_week, int current_offset, int starting_group, bool is_first) {
|
||||||
// append colles for specified week and group
|
// append colles for specified week and group
|
||||||
//usleep(100000);
|
//usleep(100000);
|
||||||
|
print_arr(stats, 5);
|
||||||
if(current_week > n_weeks) {
|
if(current_week > n_weeks) {
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
assert(0);
|
*abort = true;
|
||||||
} else {
|
} else {
|
||||||
int n_available_i = 0;
|
int n_available_i = 0;
|
||||||
int n_available_j = 0;
|
int n_available_j = 0;
|
||||||
|
@ -362,10 +424,10 @@ void aux(int* weeks_len, creneau* edt, int len_edt, colleur* chads, int n_chads,
|
||||||
succ = 1;
|
succ = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Colles for week %d, group %d\n", current_week, current_grp);
|
printf("Colles for week %d, group %d {%d}\n", current_week, current_grp, (1-(*abort))*weeks_len[current_week-1]);
|
||||||
|
|
||||||
//for(int i = 0; i < weeks_len[current_week]; i++) { // loop for 1st colle
|
//for(int i = 0; i < weeks_len[current_week]; i++) { // loop for 1st colle
|
||||||
for(int i = 0; i < 16; i++) { // loop for 1st colle
|
for(int i = 0; i < (1-(*abort))*weeks_len[current_week-1]; i++) { // loop for 1st colle
|
||||||
//printf("+1\n");
|
//printf("+1\n");
|
||||||
//printf("i(%d -> %d)i\n", current_grp, current_offset+i);
|
//printf("i(%d -> %d)i\n", current_grp, current_offset+i);
|
||||||
//printf(" ");
|
//printf(" ");
|
||||||
|
@ -389,23 +451,23 @@ void aux(int* weeks_len, creneau* edt, int len_edt, colleur* chads, int n_chads,
|
||||||
is_valid_i = false;
|
is_valid_i = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_valid_i) {
|
if(is_valid_i && *abort == 0) {
|
||||||
// /!\ DONT FORGET THE RECURSIVE CALL HERE (in case a group has only 1 colle that week)
|
// /!\ DONT FORGET THE RECURSIVE CALL HERE (in case a group has only 1 colle that week)
|
||||||
//aux(weeks_len, edt, chads, n_chads, n_groups, n_weeks, current_grp, current_week, current_offset, starting_group, is_first);
|
//aux(weeks_len, edt, chads, n_chads, n_groups, n_weeks, current_grp, current_week, current_offset, starting_group, is_first);
|
||||||
|
|
||||||
if(succ == starting_group) {
|
if(succ == starting_group) {
|
||||||
//printf("---------------------------------------------------------\n");
|
//printf("---------------------------------------------------------\n");
|
||||||
aux(weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, succ, current_week+1, current_offset+weeks_len[current_week-1], succ, true);
|
aux(abort, weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, current_grp, current_week+1, current_offset+weeks_len[current_week-1], current_grp, true);
|
||||||
} else {
|
} else {
|
||||||
if(current_grp == n_groups) {
|
if(current_grp == n_groups) {
|
||||||
aux(weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, 1, current_week, current_offset, starting_group, false);
|
aux(abort, weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, 1, current_week, current_offset, starting_group, false);
|
||||||
} else {
|
} else {
|
||||||
aux(weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, current_grp+1, current_week, current_offset, starting_group, is_first);
|
aux(abort, weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, current_grp+1, current_week, current_offset, starting_group, is_first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int j = 0; j < 16; j++) { // loop for 1st colle
|
for(int j = 0; j < (1-(*abort))*weeks_len[current_week-1]; j++) { // loop for 1st colle
|
||||||
//printf("j(%d -> %d)j\n", current_grp, current_offset+j);
|
//printf("j(%d -> %d)j\n", current_grp, current_offset+j);
|
||||||
//printf(" ");
|
//printf(" ");
|
||||||
//printf("[%d]\n", current_offset+i);
|
//printf("[%d]\n", current_offset+i);
|
||||||
|
@ -428,23 +490,23 @@ void aux(int* weeks_len, creneau* edt, int len_edt, colleur* chads, int n_chads,
|
||||||
is_valid_j = false;
|
is_valid_j = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_valid_j) {
|
if(is_valid_j && *abort == 0) {
|
||||||
// THE RECURSIVE CALL
|
// THE RECURSIVE CALL
|
||||||
//aux(weeks_len, edt, chads, n_chads, n_groups, n_weeks, current_grp, current_week, current_offset, starting_group, is_first);
|
//aux(weeks_len, edt, chads, n_chads, n_groups, n_weeks, current_grp, current_week, current_offset, starting_group, is_first);
|
||||||
|
|
||||||
if(succ == starting_group) {
|
if(succ == starting_group) {
|
||||||
//printf("---------------------------------------------------------\n");
|
//printf("---------------------------------------------------------\n");
|
||||||
aux(weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, succ, current_week+1, current_offset+weeks_len[current_week-1], succ, true);
|
aux(abort, weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, current_grp, current_week+1, current_offset+weeks_len[current_week-1], current_grp, true);
|
||||||
} else {
|
} else {
|
||||||
if(current_grp == n_groups) {
|
if(current_grp == n_groups) {
|
||||||
aux(weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, 1, current_week, current_offset, starting_group, false);
|
aux(abort, weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, 1, current_week, current_offset, starting_group, false);
|
||||||
} else {
|
} else {
|
||||||
aux(weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, current_grp+1, current_week, current_offset, starting_group, is_first);
|
aux(abort, weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, current_grp+1, current_week, current_offset, starting_group, is_first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n_available_j != 0) {
|
if(n_available_j != 0 && *abort == 0) {
|
||||||
// remove 2nd colle in case it's blocked
|
// remove 2nd colle in case it's blocked
|
||||||
edt[current_offset+j].group = 0;
|
edt[current_offset+j].group = 0;
|
||||||
edt[current_offset+j].name[0] = '\0';
|
edt[current_offset+j].name[0] = '\0';
|
||||||
|
@ -455,7 +517,7 @@ void aux(int* weeks_len, creneau* edt, int len_edt, colleur* chads, int n_chads,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n_available_i != 0) {
|
if(n_available_i != 0 && *abort == 0) {
|
||||||
// remove 1st colle in case it's blocked
|
// remove 1st colle in case it's blocked
|
||||||
edt[current_offset+i].group = 0;
|
edt[current_offset+i].group = 0;
|
||||||
edt[current_offset+i].name[0] = '\0';
|
edt[current_offset+i].name[0] = '\0';
|
||||||
|
@ -471,15 +533,6 @@ void aux(int* weeks_len, creneau* edt, int len_edt, colleur* chads, int n_chads,
|
||||||
//printf("[terminated : group %d with week %d]\n", current_grp, current_week);
|
//printf("[terminated : group %d with week %d]\n", current_grp, current_week);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void print_arr(int* arr, int len) {
|
|
||||||
printf("[");
|
|
||||||
for(int i = 0; i < len; i++) {
|
|
||||||
printf("%d ", arr[i]);
|
|
||||||
}
|
|
||||||
printf("]\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void generate_colles_v1(creneau* edt, int len_edt, colleur* chads, int n_chads, int n_groups, int n_weeks) {
|
void generate_colles_v1(creneau* edt, int len_edt, colleur* chads, int n_chads, int n_groups, int n_weeks) {
|
||||||
// Fill edt with a colloscope
|
// Fill edt with a colloscope
|
||||||
// The final function
|
// The final function
|
||||||
|
@ -495,15 +548,26 @@ void generate_colles_v1(creneau* edt, int len_edt, colleur* chads, int n_chads,
|
||||||
}
|
}
|
||||||
current++;
|
current++;
|
||||||
}
|
}
|
||||||
weeks_len[3] = 16;
|
|
||||||
|
|
||||||
print_arr(weeks_len, n_weeks);
|
print_arr(weeks_len, n_weeks);
|
||||||
|
|
||||||
aux(weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, 1, 1, 0, 1, true);
|
stats = malloc(sizeof(int)*5);
|
||||||
|
for(int i = 0; i < 5; i++) {
|
||||||
|
stats[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Entering aux\n");
|
||||||
|
int abort = 0;
|
||||||
|
int* ptrbool = &abort;
|
||||||
|
aux(ptrbool, weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, 1, 1, 0, 1, true);
|
||||||
|
|
||||||
//aux(weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, 1, current_week, current_offset, starting_group, false);
|
//aux(weeks_len, edt, len_edt, chads, n_chads, n_groups, n_weeks, 1, current_week, current_offset, starting_group, false);
|
||||||
|
|
||||||
|
print_one_week(edt, len_edt, edt[0].date);
|
||||||
|
print_one_week(edt, len_edt, edt[16].date);
|
||||||
|
|
||||||
free(weeks_len);
|
free(weeks_len);
|
||||||
|
free(stats);
|
||||||
printf("It's over\n");
|
printf("It's over\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
display.c
20
display.c
|
@ -1,5 +1,6 @@
|
||||||
#include "structure.c"
|
#include "structure.c"
|
||||||
|
|
||||||
|
/*
|
||||||
void remove_lanes(int n) {
|
void remove_lanes(int n) {
|
||||||
for(int i = 0; i < n; i++) {
|
for(int i = 0; i < n; i++) {
|
||||||
printf("\x1b[1F");
|
printf("\x1b[1F");
|
||||||
|
@ -236,16 +237,16 @@ void drawDateToRenderer(SDL_Renderer* renderer, date d, int X, int Y, int W, int
|
||||||
cX += (1+ln_baseN(d.day, 10))*W;
|
cX += (1+ln_baseN(d.day, 10))*W;
|
||||||
drawCharToRenderer(renderer, '-', cX, Y, W, H);
|
drawCharToRenderer(renderer, '-', cX, Y, W, H);
|
||||||
drawNumberToRenderer(renderer, d.year, cX, Y, W, H, 0);
|
drawNumberToRenderer(renderer, d.year, cX, Y, W, H, 0);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void print_one_week(SDL_Renderer* renderer, creneau* edt, int len_creneau, date start) { /*
|
void print_one_week(creneau* edt, int len_creneau, date start) { /*
|
||||||
1) print names
|
1) print names
|
||||||
2) print weeks
|
2) print weeks
|
||||||
3) print groups */
|
3) print groups */
|
||||||
resetRenderer(renderer);
|
//resetRenderer(renderer);
|
||||||
|
|
||||||
int wd = 75/3;
|
//int wd = 75/3;
|
||||||
int ht = 105/3;
|
//int ht = 105/3;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -254,8 +255,8 @@ void print_one_week(SDL_Renderer* renderer, creneau* edt, int len_creneau, date
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawStringToRenderer(renderer, "from", 10, 10, wd, ht);
|
//drawStringToRenderer(renderer, "from", 10, 10, wd, ht);
|
||||||
drawDateToRenderer(renderer, edt[i].date, 10+5*wd, 10, wd, ht);
|
//drawDateToRenderer(renderer, edt[i].date, 10+5*wd, 10, wd, ht);
|
||||||
|
|
||||||
// print the corresponding week
|
// print the corresponding week
|
||||||
while(i < len_creneau && (date_dist(start, edt[i].date) < 7)) {
|
while(i < len_creneau && (date_dist(start, edt[i].date) < 7)) {
|
||||||
|
@ -275,6 +276,7 @@ void print_one_week(SDL_Renderer* renderer, creneau* edt, int len_creneau, date
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if(i < len_creneau) {
|
if(i < len_creneau) {
|
||||||
drawStringToRenderer(renderer, "to", width/2+3*wd, 10, wd, ht);
|
drawStringToRenderer(renderer, "to", width/2+3*wd, 10, wd, ht);
|
||||||
drawDateToRenderer(renderer, edt[i].date, width/2+5*wd, 10, wd, ht);
|
drawDateToRenderer(renderer, edt[i].date, width/2+5*wd, 10, wd, ht);
|
||||||
|
@ -282,6 +284,6 @@ void print_one_week(SDL_Renderer* renderer, creneau* edt, int len_creneau, date
|
||||||
drawStringToRenderer(renderer, "to", width/2+3*wd, 10, wd, ht);
|
drawStringToRenderer(renderer, "to", width/2+3*wd, 10, wd, ht);
|
||||||
drawDateToRenderer(renderer, edt[i-1].date, width/2+5*wd, 10, wd, ht);
|
drawDateToRenderer(renderer, edt[i-1].date, width/2+5*wd, 10, wd, ht);
|
||||||
}
|
}
|
||||||
updateRenderer(renderer);
|
updateRenderer(renderer);*/
|
||||||
usleep(3000000);
|
//usleep(3000000);
|
||||||
}
|
}
|
18
main.c
18
main.c
|
@ -5,20 +5,12 @@
|
||||||
int main() {
|
int main() {
|
||||||
printf("Starting\n");
|
printf("Starting\n");
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
|
|
||||||
printf("error initializing SDL: %s\n", SDL_GetError());
|
|
||||||
}
|
|
||||||
SDL_Window* win = SDL_CreateWindow("a game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, 0);
|
|
||||||
|
|
||||||
Uint32 render_flags = SDL_RENDERER_ACCELERATED;
|
|
||||||
SDL_Renderer* rend = SDL_CreateRenderer(win, -1, render_flags);
|
|
||||||
SDL_SetRenderDrawBlendMode(rend, SDL_BLENDMODE_BLEND);
|
|
||||||
|
|
||||||
creneau* edt = import_creneaux("file.txt", 64);
|
creneau* edt = import_creneaux("file.txt", 64);
|
||||||
int len_creneau = 64;
|
int len_creneau = 64;
|
||||||
|
|
||||||
colleur* dudes = import_colleurs("some_data.txt", 7, 64);
|
colleur* dudes = import_colleurs("some_data.txt", 13, 64);
|
||||||
int n_colleurs = 7;
|
int n_colleurs = 13;
|
||||||
|
|
||||||
//printf("%d %d %d %d\n", edt[10].date.hour, edt[10].date.day, edt[10].date.month, edt[10].date.year);
|
//printf("%d %d %d %d\n", edt[10].date.hour, edt[10].date.day, edt[10].date.month, edt[10].date.year);
|
||||||
//printf("%d\n", date_dist(d1, d1));
|
//printf("%d\n", date_dist(d1, d1));
|
||||||
|
@ -42,7 +34,7 @@ int main() {
|
||||||
|
|
||||||
// {char* name; int namelen; topic mat; date* disp; int n_disp;} colleur;
|
// {char* name; int namelen; topic mat; date* disp; int n_disp;} colleur;
|
||||||
|
|
||||||
generate_colles_v1(edt, len_creneau, dudes, n_colleurs, 7, 4);
|
generate_colles_v1(edt, len_creneau, dudes, n_colleurs, 8, 4);
|
||||||
//generate_colles_v1(edt, len_creneau, dudes, n_colleurs, 15, 4);
|
//generate_colles_v1(edt, len_creneau, dudes, n_colleurs, 15, 4);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -53,9 +45,5 @@ int main() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
free(edt);
|
free(edt);
|
||||||
|
|
||||||
SDL_DestroyRenderer(rend);
|
|
||||||
SDL_DestroyWindow(win);
|
|
||||||
SDL_Quit();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
402
some_data.txt
402
some_data.txt
|
@ -132,6 +132,140 @@ MATH
|
||||||
17 1 3 2024
|
17 1 3 2024
|
||||||
18 1 3 2024
|
18 1 3 2024
|
||||||
+
|
+
|
||||||
|
Boully
|
||||||
|
MATH
|
||||||
|
12 5 2 2024
|
||||||
|
13 5 2 2024
|
||||||
|
18 5 2 2024
|
||||||
|
17 6 2 2024
|
||||||
|
18 6 2 2024
|
||||||
|
14 7 2 2024
|
||||||
|
15 7 2 2024
|
||||||
|
16 7 2 2024
|
||||||
|
17 7 2 2024
|
||||||
|
18 7 2 2024
|
||||||
|
14 8 2 2024
|
||||||
|
15 8 2 2024
|
||||||
|
18 8 2 2024
|
||||||
|
16 9 2 2024
|
||||||
|
17 9 2 2024
|
||||||
|
18 9 2 2024
|
||||||
|
12 12 2 2024
|
||||||
|
13 12 2 2024
|
||||||
|
18 12 2 2024
|
||||||
|
17 13 2 2024
|
||||||
|
18 13 2 2024
|
||||||
|
14 14 2 2024
|
||||||
|
15 14 2 2024
|
||||||
|
16 14 2 2024
|
||||||
|
17 14 2 2024
|
||||||
|
18 14 2 2024
|
||||||
|
14 15 2 2024
|
||||||
|
15 15 2 2024
|
||||||
|
18 15 2 2024
|
||||||
|
16 16 2 2024
|
||||||
|
17 16 2 2024
|
||||||
|
18 16 2 2024
|
||||||
|
12 19 2 2024
|
||||||
|
13 19 2 2024
|
||||||
|
18 19 2 2024
|
||||||
|
17 20 2 2024
|
||||||
|
18 20 2 2024
|
||||||
|
14 21 2 2024
|
||||||
|
15 21 2 2024
|
||||||
|
16 21 2 2024
|
||||||
|
17 21 2 2024
|
||||||
|
18 21 2 2024
|
||||||
|
14 22 2 2024
|
||||||
|
15 22 2 2024
|
||||||
|
18 22 2 2024
|
||||||
|
16 23 2 2024
|
||||||
|
17 23 2 2024
|
||||||
|
18 23 2 2024
|
||||||
|
12 26 2 2024
|
||||||
|
13 26 2 2024
|
||||||
|
18 26 2 2024
|
||||||
|
17 27 2 2024
|
||||||
|
18 27 2 2024
|
||||||
|
14 28 2 2024
|
||||||
|
15 28 2 2024
|
||||||
|
16 28 2 2024
|
||||||
|
17 28 2 2024
|
||||||
|
18 28 2 2024
|
||||||
|
14 29 2 2024
|
||||||
|
15 29 2 2024
|
||||||
|
18 29 2 2024
|
||||||
|
16 1 3 2024
|
||||||
|
17 1 3 2024
|
||||||
|
18 1 3 2024
|
||||||
|
+
|
||||||
|
Carpintero
|
||||||
|
MATH
|
||||||
|
12 5 2 2024
|
||||||
|
13 5 2 2024
|
||||||
|
18 5 2 2024
|
||||||
|
17 6 2 2024
|
||||||
|
18 6 2 2024
|
||||||
|
14 7 2 2024
|
||||||
|
15 7 2 2024
|
||||||
|
16 7 2 2024
|
||||||
|
17 7 2 2024
|
||||||
|
18 7 2 2024
|
||||||
|
14 8 2 2024
|
||||||
|
15 8 2 2024
|
||||||
|
18 8 2 2024
|
||||||
|
16 9 2 2024
|
||||||
|
17 9 2 2024
|
||||||
|
18 9 2 2024
|
||||||
|
12 12 2 2024
|
||||||
|
13 12 2 2024
|
||||||
|
18 12 2 2024
|
||||||
|
17 13 2 2024
|
||||||
|
18 13 2 2024
|
||||||
|
14 14 2 2024
|
||||||
|
15 14 2 2024
|
||||||
|
16 14 2 2024
|
||||||
|
17 14 2 2024
|
||||||
|
18 14 2 2024
|
||||||
|
14 15 2 2024
|
||||||
|
15 15 2 2024
|
||||||
|
18 15 2 2024
|
||||||
|
16 16 2 2024
|
||||||
|
17 16 2 2024
|
||||||
|
18 16 2 2024
|
||||||
|
12 19 2 2024
|
||||||
|
13 19 2 2024
|
||||||
|
18 19 2 2024
|
||||||
|
17 20 2 2024
|
||||||
|
18 20 2 2024
|
||||||
|
14 21 2 2024
|
||||||
|
15 21 2 2024
|
||||||
|
16 21 2 2024
|
||||||
|
17 21 2 2024
|
||||||
|
18 21 2 2024
|
||||||
|
14 22 2 2024
|
||||||
|
15 22 2 2024
|
||||||
|
18 22 2 2024
|
||||||
|
16 23 2 2024
|
||||||
|
17 23 2 2024
|
||||||
|
18 23 2 2024
|
||||||
|
12 26 2 2024
|
||||||
|
13 26 2 2024
|
||||||
|
18 26 2 2024
|
||||||
|
17 27 2 2024
|
||||||
|
18 27 2 2024
|
||||||
|
14 28 2 2024
|
||||||
|
15 28 2 2024
|
||||||
|
16 28 2 2024
|
||||||
|
17 28 2 2024
|
||||||
|
18 28 2 2024
|
||||||
|
14 29 2 2024
|
||||||
|
15 29 2 2024
|
||||||
|
18 29 2 2024
|
||||||
|
16 1 3 2024
|
||||||
|
17 1 3 2024
|
||||||
|
18 1 3 2024
|
||||||
|
+
|
||||||
Colin
|
Colin
|
||||||
PHYSICS
|
PHYSICS
|
||||||
12 5 2 2024
|
12 5 2 2024
|
||||||
|
@ -266,6 +400,140 @@ PHYSICS
|
||||||
17 1 3 2024
|
17 1 3 2024
|
||||||
18 1 3 2024
|
18 1 3 2024
|
||||||
+
|
+
|
||||||
|
Chibani
|
||||||
|
PHYSICS
|
||||||
|
12 5 2 2024
|
||||||
|
13 5 2 2024
|
||||||
|
18 5 2 2024
|
||||||
|
17 6 2 2024
|
||||||
|
18 6 2 2024
|
||||||
|
14 7 2 2024
|
||||||
|
15 7 2 2024
|
||||||
|
16 7 2 2024
|
||||||
|
17 7 2 2024
|
||||||
|
18 7 2 2024
|
||||||
|
14 8 2 2024
|
||||||
|
15 8 2 2024
|
||||||
|
18 8 2 2024
|
||||||
|
16 9 2 2024
|
||||||
|
17 9 2 2024
|
||||||
|
18 9 2 2024
|
||||||
|
12 12 2 2024
|
||||||
|
13 12 2 2024
|
||||||
|
18 12 2 2024
|
||||||
|
17 13 2 2024
|
||||||
|
18 13 2 2024
|
||||||
|
14 14 2 2024
|
||||||
|
15 14 2 2024
|
||||||
|
16 14 2 2024
|
||||||
|
17 14 2 2024
|
||||||
|
18 14 2 2024
|
||||||
|
14 15 2 2024
|
||||||
|
15 15 2 2024
|
||||||
|
18 15 2 2024
|
||||||
|
16 16 2 2024
|
||||||
|
17 16 2 2024
|
||||||
|
18 16 2 2024
|
||||||
|
12 19 2 2024
|
||||||
|
13 19 2 2024
|
||||||
|
18 19 2 2024
|
||||||
|
17 20 2 2024
|
||||||
|
18 20 2 2024
|
||||||
|
14 21 2 2024
|
||||||
|
15 21 2 2024
|
||||||
|
16 21 2 2024
|
||||||
|
17 21 2 2024
|
||||||
|
18 21 2 2024
|
||||||
|
14 22 2 2024
|
||||||
|
15 22 2 2024
|
||||||
|
18 22 2 2024
|
||||||
|
16 23 2 2024
|
||||||
|
17 23 2 2024
|
||||||
|
18 23 2 2024
|
||||||
|
12 26 2 2024
|
||||||
|
13 26 2 2024
|
||||||
|
18 26 2 2024
|
||||||
|
17 27 2 2024
|
||||||
|
18 27 2 2024
|
||||||
|
14 28 2 2024
|
||||||
|
15 28 2 2024
|
||||||
|
16 28 2 2024
|
||||||
|
17 28 2 2024
|
||||||
|
18 28 2 2024
|
||||||
|
14 29 2 2024
|
||||||
|
15 29 2 2024
|
||||||
|
18 29 2 2024
|
||||||
|
16 1 3 2024
|
||||||
|
17 1 3 2024
|
||||||
|
18 1 3 2024
|
||||||
|
+
|
||||||
|
Chevalier
|
||||||
|
PHYSICS
|
||||||
|
12 5 2 2024
|
||||||
|
13 5 2 2024
|
||||||
|
18 5 2 2024
|
||||||
|
17 6 2 2024
|
||||||
|
18 6 2 2024
|
||||||
|
14 7 2 2024
|
||||||
|
15 7 2 2024
|
||||||
|
16 7 2 2024
|
||||||
|
17 7 2 2024
|
||||||
|
18 7 2 2024
|
||||||
|
14 8 2 2024
|
||||||
|
15 8 2 2024
|
||||||
|
18 8 2 2024
|
||||||
|
16 9 2 2024
|
||||||
|
17 9 2 2024
|
||||||
|
18 9 2 2024
|
||||||
|
12 12 2 2024
|
||||||
|
13 12 2 2024
|
||||||
|
18 12 2 2024
|
||||||
|
17 13 2 2024
|
||||||
|
18 13 2 2024
|
||||||
|
14 14 2 2024
|
||||||
|
15 14 2 2024
|
||||||
|
16 14 2 2024
|
||||||
|
17 14 2 2024
|
||||||
|
18 14 2 2024
|
||||||
|
14 15 2 2024
|
||||||
|
15 15 2 2024
|
||||||
|
18 15 2 2024
|
||||||
|
16 16 2 2024
|
||||||
|
17 16 2 2024
|
||||||
|
18 16 2 2024
|
||||||
|
12 19 2 2024
|
||||||
|
13 19 2 2024
|
||||||
|
18 19 2 2024
|
||||||
|
17 20 2 2024
|
||||||
|
18 20 2 2024
|
||||||
|
14 21 2 2024
|
||||||
|
15 21 2 2024
|
||||||
|
16 21 2 2024
|
||||||
|
17 21 2 2024
|
||||||
|
18 21 2 2024
|
||||||
|
14 22 2 2024
|
||||||
|
15 22 2 2024
|
||||||
|
18 22 2 2024
|
||||||
|
16 23 2 2024
|
||||||
|
17 23 2 2024
|
||||||
|
18 23 2 2024
|
||||||
|
12 26 2 2024
|
||||||
|
13 26 2 2024
|
||||||
|
18 26 2 2024
|
||||||
|
17 27 2 2024
|
||||||
|
18 27 2 2024
|
||||||
|
14 28 2 2024
|
||||||
|
15 28 2 2024
|
||||||
|
16 28 2 2024
|
||||||
|
17 28 2 2024
|
||||||
|
18 28 2 2024
|
||||||
|
14 29 2 2024
|
||||||
|
15 29 2 2024
|
||||||
|
18 29 2 2024
|
||||||
|
16 1 3 2024
|
||||||
|
17 1 3 2024
|
||||||
|
18 1 3 2024
|
||||||
|
+
|
||||||
Belaggoune
|
Belaggoune
|
||||||
ENGLISH
|
ENGLISH
|
||||||
12 5 2 2024
|
12 5 2 2024
|
||||||
|
@ -400,6 +668,140 @@ ENGLISH
|
||||||
17 1 3 2024
|
17 1 3 2024
|
||||||
18 1 3 2024
|
18 1 3 2024
|
||||||
+
|
+
|
||||||
|
Le_Gourielec
|
||||||
|
ENGLISH
|
||||||
|
12 5 2 2024
|
||||||
|
13 5 2 2024
|
||||||
|
18 5 2 2024
|
||||||
|
17 6 2 2024
|
||||||
|
18 6 2 2024
|
||||||
|
14 7 2 2024
|
||||||
|
15 7 2 2024
|
||||||
|
16 7 2 2024
|
||||||
|
17 7 2 2024
|
||||||
|
18 7 2 2024
|
||||||
|
14 8 2 2024
|
||||||
|
15 8 2 2024
|
||||||
|
18 8 2 2024
|
||||||
|
16 9 2 2024
|
||||||
|
17 9 2 2024
|
||||||
|
18 9 2 2024
|
||||||
|
12 12 2 2024
|
||||||
|
13 12 2 2024
|
||||||
|
18 12 2 2024
|
||||||
|
17 13 2 2024
|
||||||
|
18 13 2 2024
|
||||||
|
14 14 2 2024
|
||||||
|
15 14 2 2024
|
||||||
|
16 14 2 2024
|
||||||
|
17 14 2 2024
|
||||||
|
18 14 2 2024
|
||||||
|
14 15 2 2024
|
||||||
|
15 15 2 2024
|
||||||
|
18 15 2 2024
|
||||||
|
16 16 2 2024
|
||||||
|
17 16 2 2024
|
||||||
|
18 16 2 2024
|
||||||
|
12 19 2 2024
|
||||||
|
13 19 2 2024
|
||||||
|
18 19 2 2024
|
||||||
|
17 20 2 2024
|
||||||
|
18 20 2 2024
|
||||||
|
14 21 2 2024
|
||||||
|
15 21 2 2024
|
||||||
|
16 21 2 2024
|
||||||
|
17 21 2 2024
|
||||||
|
18 21 2 2024
|
||||||
|
14 22 2 2024
|
||||||
|
15 22 2 2024
|
||||||
|
18 22 2 2024
|
||||||
|
16 23 2 2024
|
||||||
|
17 23 2 2024
|
||||||
|
18 23 2 2024
|
||||||
|
12 26 2 2024
|
||||||
|
13 26 2 2024
|
||||||
|
18 26 2 2024
|
||||||
|
17 27 2 2024
|
||||||
|
18 27 2 2024
|
||||||
|
14 28 2 2024
|
||||||
|
15 28 2 2024
|
||||||
|
16 28 2 2024
|
||||||
|
17 28 2 2024
|
||||||
|
18 28 2 2024
|
||||||
|
14 29 2 2024
|
||||||
|
15 29 2 2024
|
||||||
|
18 29 2 2024
|
||||||
|
16 1 3 2024
|
||||||
|
17 1 3 2024
|
||||||
|
18 1 3 2024
|
||||||
|
+
|
||||||
|
Herbaud
|
||||||
|
ENGLISH
|
||||||
|
12 5 2 2024
|
||||||
|
13 5 2 2024
|
||||||
|
18 5 2 2024
|
||||||
|
17 6 2 2024
|
||||||
|
18 6 2 2024
|
||||||
|
14 7 2 2024
|
||||||
|
15 7 2 2024
|
||||||
|
16 7 2 2024
|
||||||
|
17 7 2 2024
|
||||||
|
18 7 2 2024
|
||||||
|
14 8 2 2024
|
||||||
|
15 8 2 2024
|
||||||
|
18 8 2 2024
|
||||||
|
16 9 2 2024
|
||||||
|
17 9 2 2024
|
||||||
|
18 9 2 2024
|
||||||
|
12 12 2 2024
|
||||||
|
13 12 2 2024
|
||||||
|
18 12 2 2024
|
||||||
|
17 13 2 2024
|
||||||
|
18 13 2 2024
|
||||||
|
14 14 2 2024
|
||||||
|
15 14 2 2024
|
||||||
|
16 14 2 2024
|
||||||
|
17 14 2 2024
|
||||||
|
18 14 2 2024
|
||||||
|
14 15 2 2024
|
||||||
|
15 15 2 2024
|
||||||
|
18 15 2 2024
|
||||||
|
16 16 2 2024
|
||||||
|
17 16 2 2024
|
||||||
|
18 16 2 2024
|
||||||
|
12 19 2 2024
|
||||||
|
13 19 2 2024
|
||||||
|
18 19 2 2024
|
||||||
|
17 20 2 2024
|
||||||
|
18 20 2 2024
|
||||||
|
14 21 2 2024
|
||||||
|
15 21 2 2024
|
||||||
|
16 21 2 2024
|
||||||
|
17 21 2 2024
|
||||||
|
18 21 2 2024
|
||||||
|
14 22 2 2024
|
||||||
|
15 22 2 2024
|
||||||
|
18 22 2 2024
|
||||||
|
16 23 2 2024
|
||||||
|
17 23 2 2024
|
||||||
|
18 23 2 2024
|
||||||
|
12 26 2 2024
|
||||||
|
13 26 2 2024
|
||||||
|
18 26 2 2024
|
||||||
|
17 27 2 2024
|
||||||
|
18 27 2 2024
|
||||||
|
14 28 2 2024
|
||||||
|
15 28 2 2024
|
||||||
|
16 28 2 2024
|
||||||
|
17 28 2 2024
|
||||||
|
18 28 2 2024
|
||||||
|
14 29 2 2024
|
||||||
|
15 29 2 2024
|
||||||
|
18 29 2 2024
|
||||||
|
16 1 3 2024
|
||||||
|
17 1 3 2024
|
||||||
|
18 1 3 2024
|
||||||
|
+
|
||||||
Jospin
|
Jospin
|
||||||
INFO
|
INFO
|
||||||
12 5 2 2024
|
12 5 2 2024
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
#include <SDL2/SDL_image.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
@ -24,8 +22,9 @@ typedef struct colleur {char* name; int namelen; topic mat; date* disp; int n_di
|
||||||
typedef struct array {int* a; int len; int memlen;} array;
|
typedef struct array {int* a; int len; int memlen;} array;
|
||||||
// yes
|
// yes
|
||||||
|
|
||||||
static int width = 1200;
|
//static int width = 1200;
|
||||||
static int height = 900;
|
//static int height = 900;
|
||||||
|
int* stats;
|
||||||
|
|
||||||
int date_dist(date d1, date d2) { /* returns distance between d1 and d2 in days
|
int date_dist(date d1, date d2) { /* returns distance between d1 and d2 in days
|
||||||
if d2 is sooner than d1, it will return -1 */
|
if d2 is sooner than d1, it will return -1 */
|
||||||
|
|
Loading…
Reference in New Issue