From 2dbd5b7320f17cc65fd3071ed32be7518514aa2b Mon Sep 17 00:00:00 2001 From: Manzovince Date: Mon, 20 May 2019 13:48:14 +0200 Subject: [PATCH 01/11] Auto stash before merge of "master" and "origin/master" + CLEANING --- fillit.h | 11 +++++------ handle_errors.c | 35 ++++++++++++++++++----------------- main.c | 5 +---- parse_input.c | 15 ++------------- 4 files changed, 26 insertions(+), 40 deletions(-) diff --git a/fillit.h b/fillit.h index faf090b..1625bc0 100644 --- a/fillit.h +++ b/fillit.h @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:34:46 by vmanzoni #+# #+# */ -/* Updated: 2019/05/17 18:37:47 by hulamy ### ########.fr */ +/* Updated: 2019/05/20 13:43:34 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,10 +14,9 @@ # define FILLIT_H #include -#include // for system call write -#include // for system call open +#include +#include #include -#include // for printf (DELETE BEFORE EVAL) #include "libft/includes/libft.h" @@ -76,8 +75,8 @@ int check_tetri_errors(char *tetri); int check_tetri_errors_proxy(char *tetri); int add_to_list(char *square, t_fillist **list, char letter); void fill_list(char line[], t_fillist *list); -void print_bits(unsigned int bits, int size); //TO DELETE BEFORE EVAL -void print_tetri(unsigned int bits, int size); //TO DELETE BEFORE EVAL +void print_bits(unsigned int bits, int size); +void print_tetri(unsigned int bits, int size); int search_map(t_fillist *list); void print_map(unsigned int *tab, int width, int height, char letter); void print_final_map(t_fillist *list, int size, int flag); diff --git a/handle_errors.c b/handle_errors.c index 6ff8593..76ca08b 100644 --- a/handle_errors.c +++ b/handle_errors.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */ -/* Updated: 2019/05/09 12:45:25 by vmanzoni ### ########.fr */ +/* Updated: 2019/05/20 13:42:07 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,27 +23,28 @@ void print_error(char *str) } /* +** UPGRADE VERSION ** Function that display error message *s on fd ** with more informations ** and exit program +** +**void print_error_extended(int error) +**{ +** if (error == 1) +** ft_putstr("error: File contains char other than '.','#' and '\\n'.\n"); +** if (error == 2) +** ft_putstr("error: File contains more than 2 '\\n' in a row.\n"); +** if (error == 3) +** ft_putstr("error: File contains less than 1 tetrimino " +** "or more than 26.\n"); +** if (error == 4) +** ft_putstr("error: Tetrimino has more or less than 4 #.\n"); +** if (error == 5) +** ft_putstr("error: Tetrimino # are not all connected.\n"); +** exit(1); +**} */ -void print_error_extended(int error) -{ - if (error == 1) - ft_putstr("error: File contains char other than '.','#' and '\\n'.\n"); - if (error == 2) - ft_putstr("error: File contains more than 2 '\\n' in a row.\n"); - if (error == 3) - ft_putstr("error: File contains less than 1 tetrimino " - "or more than 26.\n"); - if (error == 4) - ft_putstr("error: Tetrimino has more or less than 4 #.\n"); - if (error == 5) - ft_putstr("error: Tetrimino # are not all connected.\n"); - exit(1); -} - /* ** Function to see if there if an error if the file ** - less than 4 lines diff --git a/main.c b/main.c index 8d39b57..3e15d9f 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */ -/* Updated: 2019/05/17 18:40:34 by hulamy ### ########.fr */ +/* Updated: 2019/05/20 13:41:00 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,11 +23,8 @@ int main(int argc, char **argv) { if (!(input = read_file(argv[1]))) print_error("error\n"); -// print_error("error: Could not read file.\n"); if (check_file_errors(input)) print_error("error\n"); -// print_error("error: Invalid file.\n"); -// print_error_extended(check_file_errors(input)); size = parse_input(input, &list); ft_putnbrendl(size); print_final_map(list, size, 1); // DEBUG diff --git a/parse_input.c b/parse_input.c index b3ef28f..ca9fd6a 100644 --- a/parse_input.c +++ b/parse_input.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/04/15 14:48:14 by vmanzoni #+# #+# */ -/* Updated: 2019/05/17 18:40:30 by hulamy ### ########.fr */ +/* Updated: 2019/05/20 13:44:23 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -44,9 +44,7 @@ unsigned short reduce_tetri(unsigned short tetri, int width) unsigned int mask; unsigned int tmp; - // cree un mask avec des 1 a gauche sur la largeur du tetriminos mask = ~0u << (32 - width) >> 16; - // fabrique la ligne pour le tetriminos de la bonne largeur tmp = tetri; tmp = (mask & tetri); tmp |= ((mask & tetri << 4) >> width); @@ -65,12 +63,9 @@ void fill_list(char line[], t_fillist *list) unsigned int mask; int i; - // transforme la ligne de . et # en un short de 0 et 1 list->tetribit = tab_to_bin(line); list->memory = 0; - // cree un mask avec des 1 sur la colonne de droite (#...#...#...#...) mask = (1 << 15) | (1 << 11) | (1 << 7) | (1 << 3); - // utilise le mask pour trouver la largeur que prend le tetriminos i = 0; while (!(mask & list->tetribit) && i++ < 4) mask >>= 1; @@ -78,20 +73,16 @@ void fill_list(char line[], t_fillist *list) while (mask & list->tetribit && ++i < 4) mask >>= 1; list->width = i - list->width; - // deplace le tetriminos tout en haut a gauche - //(i - list->width = le nombre de colonne vide a gauche) list->tetribit <<= (i - list->width); while (!(list->tetribit & (~0u << 12))) list->tetribit <<= 4; - // trouve la hauteur du tetri i = 0; while (i < 4 && list->tetribit & (~0u << 28 >> (i * 4 + 16))) i++; list->height = i; - // fabrique la ligne pour le tetriminos de la bonne largeur list->tetribit = reduce_tetri(list->tetribit, list->width); list->position = 0; - list->test = 0; // DEBUG pour que print_final_map puisse imprimer correctement au fur et a mesure + list->test = 0; // DEBUG pour que print_final_map puisse imprimer correctement au fur et a mesure } /* @@ -142,8 +133,6 @@ int parse_input(char *input, t_fillist **list) tetri[19] = '\0'; if (check_tetri_errors(tetri)) print_error("error\n"); -// print_error("error: Wrong tetrimino.\n"); -// print_error_extended(check_tetri_errors(tetri)); add_to_list(tetri, list, letter++); while (input[i] && input[i] != '.' && input[i] != '#') i++; From 79a5fb188c9471deaa271a40788097416b0e8fe9 Mon Sep 17 00:00:00 2001 From: Manzovince Date: Wed, 29 May 2019 13:10:21 +0200 Subject: [PATCH 02/11] correction on fillit.h --- fillit.h | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/fillit.h b/fillit.h index 839e1ef..17a4f8d 100644 --- a/fillit.h +++ b/fillit.h @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:34:46 by vmanzoni #+# #+# */ -/* Updated: 2019/05/28 16:51:44 by hulamy ### ########.fr */ +/* Updated: 2019/05/29 13:09:41 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -139,23 +139,6 @@ char *init_print_map(t_fillist *list, int size); void print_letter_map(t_fillist *list, int size, int flag); void print_final_map(t_fillist *list, int size); -<<<<<<< HEAD -char *read_file(char *file); -void print_error(char *s); -void print_error_extended(int error); -int parse_input(char *input, t_fillist **list); -int check_file_errors(char *file); -int check_tetri_errors(char *tetri); -int check_tetri_errors_proxy(char *tetri); -int add_to_list(char *square, t_fillist **list, char letter); -void fill_list(char line[], t_fillist *list); -void print_bits(unsigned int bits, int size); -void print_tetri(unsigned int bits, int size); -int search_map(t_fillist *list); -void print_map(unsigned int *tab, int width, int height, char letter); -void print_final_map(t_fillist *list, int size, int flag); -======= ->>>>>>> master -void ft_put_tetri_color(char c); +void ft_put_tetri_color(char c); #endif From eea8110abdf4b7f8cb86ddd854a4d2f8ba1834f1 Mon Sep 17 00:00:00 2001 From: Manzovince Date: Wed, 29 May 2019 13:12:31 +0200 Subject: [PATCH 03/11] correction on main.c (working for me now) --- main.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/main.c b/main.c index 56f5081..f03c94d 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */ -/* Updated: 2019/05/28 17:26:07 by hulamy ### ########.fr */ +/* Updated: 2019/05/29 13:12:03 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -82,22 +82,14 @@ int main(int ac, char **av) dope = create_dope(av[3], (mdp = is_mdp(ac, av))); if (ac == 2 || mdp) { -<<<<<<< HEAD - if (!(input = read_file(argv[1]))) - print_error("error\n"); - if (check_file_errors(input)) - print_error("error\n"); - size = parse_input(input, &list); - ft_putnbrendl(size); - print_final_map(list, size, 1); // DEBUG - print_final_map(list, size, 0); // DEBUG -======= +// ft_putnbrendl(size); +// print_final_map(list, size, 1); // DEBUG +// print_final_map(list, size, 0); // DEBUG if (!(input = read_file(av[1]))) print_error(dope[3] ? "error: Could not read file.\n" : "error\n"); check_file_errors(input, dope); size = parse_input(input, &list, dope); print_final_map(list, size); ->>>>>>> master } else print_error("usage: Please submit a file.\n> ./fillit file.fillit\n"); From 246906a4901bc9798f833758703e1ad94a32a441 Mon Sep 17 00:00:00 2001 From: Manzovince Date: Wed, 29 May 2019 13:15:53 +0200 Subject: [PATCH 04/11] all test files grouped in folder --- test_add_to_list.c => test_files/test_add_to_list.c | 0 test_big_map.c => test_files/test_big_map.c | 0 test_big_tetri.c => test_files/test_big_tetri.c | 0 .../test_get_smallest_square.c | 0 test_mask.c => test_files/test_mask.c | 0 test_othermethod_fillit.c => test_files/test_othermethod_fillit.c | 0 test_print_fillit.c => test_files/test_print_fillit.c | 0 test_search_map2.c => test_files/test_search_map2.c | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename test_add_to_list.c => test_files/test_add_to_list.c (100%) rename test_big_map.c => test_files/test_big_map.c (100%) rename test_big_tetri.c => test_files/test_big_tetri.c (100%) rename test_get_smallest_square.c => test_files/test_get_smallest_square.c (100%) rename test_mask.c => test_files/test_mask.c (100%) rename test_othermethod_fillit.c => test_files/test_othermethod_fillit.c (100%) rename test_print_fillit.c => test_files/test_print_fillit.c (100%) rename test_search_map2.c => test_files/test_search_map2.c (100%) diff --git a/test_add_to_list.c b/test_files/test_add_to_list.c similarity index 100% rename from test_add_to_list.c rename to test_files/test_add_to_list.c diff --git a/test_big_map.c b/test_files/test_big_map.c similarity index 100% rename from test_big_map.c rename to test_files/test_big_map.c diff --git a/test_big_tetri.c b/test_files/test_big_tetri.c similarity index 100% rename from test_big_tetri.c rename to test_files/test_big_tetri.c diff --git a/test_get_smallest_square.c b/test_files/test_get_smallest_square.c similarity index 100% rename from test_get_smallest_square.c rename to test_files/test_get_smallest_square.c diff --git a/test_mask.c b/test_files/test_mask.c similarity index 100% rename from test_mask.c rename to test_files/test_mask.c diff --git a/test_othermethod_fillit.c b/test_files/test_othermethod_fillit.c similarity index 100% rename from test_othermethod_fillit.c rename to test_files/test_othermethod_fillit.c diff --git a/test_print_fillit.c b/test_files/test_print_fillit.c similarity index 100% rename from test_print_fillit.c rename to test_files/test_print_fillit.c diff --git a/test_search_map2.c b/test_files/test_search_map2.c similarity index 100% rename from test_search_map2.c rename to test_files/test_search_map2.c From fa5f2e7f00d896fe3b96748518b7e562a93f8a50 Mon Sep 17 00:00:00 2001 From: Manzovince Date: Wed, 29 May 2019 13:36:40 +0200 Subject: [PATCH 05/11] new version of fillit.h with details --- .DS_Store | Bin 8196 -> 0 bytes f_handle_errors.c | 4 ++-- fillit.h | 18 +++++++++++------- libft | 1 - main.c | 11 ++++------- 5 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 .DS_Store delete mode 120000 libft diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5c5092dfca15558b80701859ce4b6d88133165e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMU2GIp6h7a!rL!{7X{`dv{SVRmQPncY@G zViBV;>63pk@quVGMtM<#k3jT^=##ODg3$*hCcdCPAPFYwxpSv=ciZBdfiO3@_uRSX zoO|y5`rSEur$mI#oY6+Kl86+pLTXF7S)d5LsPjrB7^z|j_9uI+tuN`MGV?6Mfe?WZ zfe?WZfe?WZf!hTE&e@_Ui{yQ&4cicb5P`cA0r7r_aTPKi$SEoPR|hx#6@XXoR=i}_QuJJ{zP+rDaTk;ml-ekCeYt2 z94pDC1f?iLHksrWMWx!w1uWcr*Qo7`^803HG-F$?*V=jok+SlNC6!9_o~7zCeb3%~ z`_%(OR?jrGy!Ox4O&4?I|>>x-EV%iYg80JMyx?s4;#F?{f;4` z7}}=_&%@E18g%_Bq3Oz++!}$yx@KMNcNrNi5g4{?RMq}tR@%^9u>^MAv{}^$?8K;P zYerPYY2T*mgL%1SZErBRy;jwS_@hvYx9A3A9i6&T=GtEo7Bx3W{cJPvh zg|5Re#DbK@_{o@$USoW%M6po{A|I8gCUS>P4^um5seU?24xOTDIz#8^JYAqK=xh3c zuF^I7gZ`wy=x-3BsKP2Vpc(720WH{yZtTEL?7|ax8b>gKairiNgX1`X=Wq(o<20u6 z3SPtOcmrqfK0d&QIE!;Qj|;enOZWztaRuMuDz4#I{D$9gGg1~&Bh`@_x!y>Sy2w8S zvwL7p*K)t~Ot|?>!1%WoW_;bwUAy)mBN@@L2-D-syrz!GrP2D<$&x987 zAJz4BEm3B^RwlJ=>L!Ibu2o3w7PURfr$8&0+DFyx3X@%1BDK2O5shjjAJ)|ML=_GH zP2pP-_$#_XztDBM$;7R|GSr|RYtf1=i2J17gT2^~gBZjx4&g9N9A)}iI0g?nOkk2J zd>Sv{MZAQUnZmF76n+zL;~l(<_n68b;bVLOx#NGEVX+;k|aZ^Iv zf;4gcMw4$p&tfiFEMifVG9vz~vt*8ZUp8$!=`pbgt`+2oM8a)JGV$XVXbV>N^D1%d zihK*w*aF(3Rr#)WdQ&Dhuu|Ordlvuxf2VIVTz`l_h`=onKzVmxcPAUn{y-_UjqpH> z>oZ(M5q48j`YzlE6EW^z$63z(!;t&2Ko<|>l$5OD^1puw5Wk+o{EsmI-`)BD9|!AN A;Q#;t diff --git a/f_handle_errors.c b/f_handle_errors.c index 74ff957..2746f4a 100644 --- a/f_handle_errors.c +++ b/f_handle_errors.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* handle_errors.c :+: :+: :+: */ +/* f_handle_errors.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */ -/* Updated: 2019/05/28 19:35:38 by hulamy ### ########.fr */ +/* Updated: 2019/05/29 13:23:02 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/fillit.h b/fillit.h index 17a4f8d..a73a692 100644 --- a/fillit.h +++ b/fillit.h @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:34:46 by vmanzoni #+# #+# */ -/* Updated: 2019/05/29 13:09:41 by vmanzoni ### ########.fr */ +/* Updated: 2019/05/29 13:31:37 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -34,6 +34,10 @@ #define CYN "\x1B[36m" #define RESET "\x1B[0m" +/* +** Color for full block tetriminos when printing colored map +** (don't forget to comment all #define COLOR above) +*/ //#define RED "\e[41m" //#define GRN "\e[42m" //#define YEL "\e[43m" @@ -52,12 +56,12 @@ ** rank : position de 1 a 32 dans l'int du tableau d'int (position % 32) ** num : memorise dans quel int du tableau on se trouve (position / 32) ** test : -** letter : -** dope : -** memory : -** same : -** next : -** start : +** letter : letter of the tetrimino for printing final map +** dope : flags for details, optimisation, printing and error +** memory : positions already tested by a tetrimino in bitwise +** same : pointer to previous identical tetrimino +** next : pointer to next tetrimino +** start : pointer to first tetrimino of input file */ typedef struct s_fillist { diff --git a/libft b/libft deleted file mode 120000 index 7d1e3da..0000000 --- a/libft +++ /dev/null @@ -1 +0,0 @@ -../03_libft \ No newline at end of file diff --git a/main.c b/main.c index f03c94d..5cf1d0c 100644 --- a/main.c +++ b/main.c @@ -6,14 +6,14 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */ -/* Updated: 2019/05/29 13:12:03 by vmanzoni ### ########.fr */ +/* Updated: 2019/05/29 13:27:14 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ #include "fillit.h" /* -** function that put the flags for bonus into a tab of int +** Function that put the flags for bonus into a tab of int ** ** d : debug print (print the map during the backtracking) ** o : optimisation ultra fast but with some errors still @@ -45,7 +45,7 @@ int *create_dope(char *av, int mdp) } /* -** function that check if the password is good to unlock the flags +** Function that check if the password is good to unlock the flags */ int is_mdp(int ac, char **av) @@ -67,7 +67,7 @@ int is_mdp(int ac, char **av) } /* -** main function +** Main function */ int main(int ac, char **av) @@ -82,9 +82,6 @@ int main(int ac, char **av) dope = create_dope(av[3], (mdp = is_mdp(ac, av))); if (ac == 2 || mdp) { -// ft_putnbrendl(size); -// print_final_map(list, size, 1); // DEBUG -// print_final_map(list, size, 0); // DEBUG if (!(input = read_file(av[1]))) print_error(dope[3] ? "error: Could not read file.\n" : "error\n"); check_file_errors(input, dope); From bfd23d6211cfca6850ab57ca897919f19849c0d2 Mon Sep 17 00:00:00 2001 From: Manzovince Date: Wed, 29 May 2019 13:37:13 +0200 Subject: [PATCH 06/11] gitignore edit for libft symlink --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 9b97ae7..00f9052 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,7 @@ a\.out fillit test_fillit\.c + +libft + +\.DS_Store From 6ca294272fea1740a184bfe24bafdaf96da0d7d8 Mon Sep 17 00:00:00 2001 From: Manzovince Date: Wed, 29 May 2019 13:37:34 +0200 Subject: [PATCH 07/11] .dSYM deleted --- fillit.dSYM/Contents/Info.plist | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 fillit.dSYM/Contents/Info.plist diff --git a/fillit.dSYM/Contents/Info.plist b/fillit.dSYM/Contents/Info.plist deleted file mode 100644 index 96bfe2d..0000000 --- a/fillit.dSYM/Contents/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - com.apple.xcode.dsym.fillit - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - dSYM - CFBundleSignature - ???? - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - From fb1a41e94fdfdc84c0f221473883fd74ad0e9ed4 Mon Sep 17 00:00:00 2001 From: Manzovince Date: Wed, 29 May 2019 13:51:43 +0200 Subject: [PATCH 08/11] correction of handle_errors.c (1 error still not solved) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quand on a une nl après le dernier tetrimino du fichier input, on devrait sortir une erreur au lieu de résoudre le fillit --- f_handle_errors.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/f_handle_errors.c b/f_handle_errors.c index 2746f4a..690f733 100644 --- a/f_handle_errors.c +++ b/f_handle_errors.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */ -/* Updated: 2019/05/29 13:23:02 by vmanzoni ### ########.fr */ +/* Updated: 2019/05/29 13:48:44 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -127,13 +127,7 @@ int check_tetri_errors_proxy(char *tetri) j++; if (i > 4 && tetri[i] == '#' && tetri[i - 5] == '#') j++; - if (tetri[i] == '.' || tetri[i] == '\n') - i++; - else if (tetri[i] == '#' && (tetri[i + 1] == '#' || tetri[i - 1] == '#' - || tetri[i + 5] == '#' || tetri[i - 5] == '#')) - i++; - else - return (1); + i++; } return ((j < 6) ? 1 : 0); } From 0236573b6d66111fbec9a35c8ccf736aa19e5e98 Mon Sep 17 00:00:00 2001 From: Manzovince Date: Wed, 29 May 2019 13:57:37 +0200 Subject: [PATCH 09/11] all debug comments deleted for norm --- f_handle_errors.c | 3 +-- f_search_map.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/f_handle_errors.c b/f_handle_errors.c index 690f733..47f2a8e 100644 --- a/f_handle_errors.c +++ b/f_handle_errors.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */ -/* Updated: 2019/05/29 13:48:44 by vmanzoni ### ########.fr */ +/* Updated: 2019/05/29 13:56:55 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -66,7 +66,6 @@ void check_file_errors(char *file, int *dope) print_error_extended(1, dope); else if (file[i] == '\n') line_nbr++; - // le if suivant verifie quoi if (file[i] == '\n' && line_nbr % 5 == 0 && file[i-1] != '\n') print_error("error\n"); if (file[i] == '\n' && file[i+1] != '\0' && \ diff --git a/f_search_map.c b/f_search_map.c index 89df20c..3a2efff 100644 --- a/f_search_map.c +++ b/f_search_map.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* search_map.c :+: :+: :+: */ +/* f_search_map.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/04/27 20:47:22 by hulamy #+# #+# */ -/* Updated: 2019/05/28 18:19:15 by hulamy ### ########.fr */ +/* Updated: 2019/05/29 13:37:51 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -135,7 +135,7 @@ int fill_map(unsigned int *map, t_fillist *list, int size) } /* -** function that send to "fill_map" a map of a certain size +** Function that send to "fill_map" a map of a certain size ** and increment its size untill it's solved */ From 7a07d84d6ca50ccfa26bc3712e20ade0f473241f Mon Sep 17 00:00:00 2001 From: Manzovince Date: Wed, 29 May 2019 15:42:31 +0200 Subject: [PATCH 10/11] README and few little corrections on code readability --- README.md | 6 ++++-- Makefile => en.lproj/Makefile | 2 +- f_read_file.c | 10 +++++----- f_search_map.c | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) rename Makefile => en.lproj/Makefile (96%) diff --git a/README.md b/README.md index 2c30b69..8bf59e3 100644 --- a/README.md +++ b/README.md @@ -18,5 +18,7 @@ Le but de ce projet est d’agencer les Tetriminos entre eux pour former le plus ## BONUS - [x] Best error handler (more details on why there is an error.) -- [ ] Optimisation -- [ ] Add colors to tetri when printing result map +- [x] Optimisation +- [x] Add colors to tetri when printing result map +- [x] Flag for debbuging (print every step in backtracking) +- [x] Adding flags (and password for blocking more args on moulinette) diff --git a/Makefile b/en.lproj/Makefile similarity index 96% rename from Makefile rename to en.lproj/Makefile index 2e01b52..161d981 100644 --- a/Makefile +++ b/en.lproj/Makefile @@ -6,7 +6,7 @@ # By: vmanzoni +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2019/03/01 13:24:35 by vmanzoni #+# #+# # -# Updated: 2019/05/17 17:11:53 by hulamy ### ########.fr # +# Updated: 2019/05/29 14:03:03 by vmanzoni ### ########.fr # # # # **************************************************************************** # diff --git a/f_read_file.c b/f_read_file.c index 0a862ec..2e2ef58 100644 --- a/f_read_file.c +++ b/f_read_file.c @@ -18,11 +18,11 @@ char *read_file(char *file) { - char buf[BUFF_SIZE]; - int fd; - int rv; - int i; - char *result; + char buf[BUFF_SIZE]; + int fd; + size_t rv; + int i; + char *result; if (((fd = open(file, O_RDONLY)) < 0) \ || ((rv = read(fd, &buf, BUFF_SIZE)) < 0) \ diff --git a/f_search_map.c b/f_search_map.c index 3a2efff..9cb1713 100644 --- a/f_search_map.c +++ b/f_search_map.c @@ -142,7 +142,7 @@ int fill_map(unsigned int *map, t_fillist *list, int size) int search_map(t_fillist *list) { t_fillist *tmp; - unsigned int *map; + unsigned int *map = NULL; int size; int num; int i; From 2bc1f50b46e2d79e0cb38a4786e51254b6a19f53 Mon Sep 17 00:00:00 2001 From: Manzovince Date: Wed, 29 May 2019 15:44:36 +0200 Subject: [PATCH 11/11] README edit --- en.lproj/Makefile => Makefile | 0 README.md | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename en.lproj/Makefile => Makefile (100%) diff --git a/en.lproj/Makefile b/Makefile similarity index 100% rename from en.lproj/Makefile rename to Makefile diff --git a/README.md b/README.md index 8bf59e3..9e08e03 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Le but de ce projet est d’agencer les Tetriminos entre eux pour former le plus ## BONUS - [x] Best error handler (more details on why there is an error.) -- [x] Optimisation +- [x] Optimisation (skip when tetri with same shape was already tested on map) - [x] Add colors to tetri when printing result map - [x] Flag for debbuging (print every step in backtracking) - [x] Adding flags (and password for blocking more args on moulinette)