From e29c0b21c522c607ac2640a067b25f27c67345d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Mogu=C3=A9rou?= Date: Tue, 16 Apr 2024 00:18:04 +0200 Subject: [PATCH] Amputation de code inutile --- algorithm.c | 22 ++++++++++++---------- algorithm.h | 2 +- structure.h | 3 +++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/algorithm.c b/algorithm.c index bfc6f16..9a0bf76 100644 --- a/algorithm.c +++ b/algorithm.c @@ -2,6 +2,7 @@ #include #include +#include "structure.h" #include "algorithm.h" bool is_equal_date(date d1, date d2) { @@ -59,16 +60,19 @@ int get_fst_offset(creneau* edt, date d) { return (date_dist(edt[0].date, d)); } +/* Feuille morte : + bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) { bool debug = false; - /* conditions (AND) : - 0) Only 1 colle at a time - 1) Alternate between physics and english - 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) - 4) Special colles (aka INFO) at least 1 every 6 weeks - */ + conditions (AND) : + * 0) Only 1 colle at a time + * 1) Alternate between physics and english + * 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) + * 4) Special colles (aka INFO) at least 1 every 6 weeks + + int end_id = get_next_friday(edt, len_edt, end); // index of first date that is later than end if(end_id == -1) { @@ -158,7 +162,6 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) { // 2) Math colles // version 2 - /* int math = 0; int abort_2 = 0; for(int i = end_id-1; i >= 0+abort_2*(end_id); i--) { @@ -185,7 +188,7 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) { if(edt[i].group == grp && edt[i].mat == MATH) { math += 1; } - }*/ + } int t = 0; int math = 0; @@ -291,7 +294,6 @@ bool is_allowed_MP2I(creneau* edt, int len_edt, int grp, date end) { return true; } -/* 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)) { // Check week diff --git a/algorithm.h b/algorithm.h index 411894b..7089c80 100644 --- a/algorithm.h +++ b/algorithm.h @@ -13,7 +13,7 @@ int get_next_friday(creneau* edt, int len_creneau, date d); 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); int heuristique_MP2I(creneau* edt, int len_edt, int grp, date end); diff --git a/structure.h b/structure.h index e3ae56d..09e7a9f 100644 --- a/structure.h +++ b/structure.h @@ -4,9 +4,12 @@ #include +/* Feuilles mortes : + extern int* stats; extern int* n_colles; +*/ typedef enum topic {NOTHING, MATH, PHYSICS, ENGLISH, FRENCH, INFO} topic; // colles subjects