diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5c5092d..0000000 Binary files a/.DS_Store and /dev/null differ 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 diff --git a/Makefile b/Makefile index 2e01b52..161d981 100644 --- a/Makefile +++ b/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/README.md b/README.md index 2c30b69..9e08e03 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 (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) diff --git a/f_handle_errors.c b/f_handle_errors.c index c713cc0..4beabb6 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/29 15:51:12 by hulamy ### ########.fr */ +/* Updated: 2019/05/29 15:52:44 by hulamy ### ########.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 89df20c..9cb1713 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,14 +135,14 @@ 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 */ int search_map(t_fillist *list) { t_fillist *tmp; - unsigned int *map; + unsigned int *map = NULL; int size; int num; int i; 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 - - diff --git a/fillit.h b/fillit.h index 2be37b9..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/28 16:51:44 by hulamy ### ########.fr */ +/* Updated: 2019/05/29 13:31:37 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" @@ -35,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" @@ -53,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 { @@ -140,6 +143,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); -void ft_put_tetri_color(char c); +void ft_put_tetri_color(char c); #endif 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 88f67f0..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/28 17:26:07 by hulamy ### ########.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) diff --git a/samples/map_hard b/samples/map_hard index 50fb7fa..887429b 100644 --- a/samples/map_hard +++ b/samples/map_hard @@ -47,43 +47,3 @@ .#.. ##.. .... - -.#.. -.#.. -##.. -.... - -...# -...# -..## -.... - -#... -###. -.... -.... - -.#.. -.#.. -##.. -.... - -.#.. -.#.. -##.. -.... - -...# -...# -..## -.... - -#... -###. -.... -.... - -.#.. -.#.. -##.. -.... 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