diff --git a/Makefile b/Makefile index c96b742..b243b37 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: vmanzoni +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2019/03/01 13:24:35 by vmanzoni #+# #+# # -# Updated: 2019/04/27 14:57:20 by vmanzoni ### ########.fr # +# Updated: 2019/04/27 15:12:16 by vmanzoni ### ########.fr # # # # **************************************************************************** # @@ -19,7 +19,7 @@ SRCS = main.c \ read_file.c \ handle_errors.c \ parse_input.c \ -# add_to_list.c \ +# add_to_list.c \ #DELETE BEFORE EVAL - NOT USED ANYMORE # get_smallest_square.c \ print_fillit.c @@ -46,7 +46,7 @@ clean: $(RM) $(OBJ_DIR) fclean: clean - make -C libft/ fclean + make -C $(LIB) fclean $(RM) $(NAME) re: fclean all diff --git a/README.md b/README.md index 92de26a..0ac238c 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,14 @@ - [x] Check if we have a file - [x] Read file - [x] Check if there are errors in file - - At least 1 tetrimino or less than 26 - [x] Check if every tetrimino is valid - - 4 char * 4 lines - - 4 blocks in 1 tetrimino - - No solo block - [x] Transform file into tetriminos - [ ] Backtracking for smallest square - [ ] Transform tetriminos to letters - [ ] Print result +- [ ] Free everything (NO LEAKS) +## BONUS - [ ] Optimisation +- [ ] `ft_check_tetri_errors` indicate which tetri is wrong +- [ ] Add colors to tetri when printing result map diff --git a/add_to_list.c b/[NOT_USED]add_to_list.c similarity index 100% rename from add_to_list.c rename to [NOT_USED]add_to_list.c diff --git a/fillit.h b/fillit.h index ffb34a0..1943b4b 100644 --- a/fillit.h +++ b/fillit.h @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:34:46 by vmanzoni #+# #+# */ -/* Updated: 2019/04/27 14:52:54 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/27 15:11:06 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,7 @@ #include // for printf (DELETE BEFORE EVAL) #include "../42-libft/includes/libft.h" -# define BUFF_SIZE 1024 +//# define BUFF_SIZE 1024 /* ** STRUCTURE diff --git a/get_smallest_square.c b/get_smallest_square.c index 80d89e8..386d4f9 100644 --- a/get_smallest_square.c +++ b/get_smallest_square.c @@ -6,30 +6,17 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/04/12 22:29:45 by vmanzoni #+# #+# */ -/* Updated: 2019/04/24 21:01:26 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/27 15:04:46 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ #include "fillit.h" /* -** Function that initialize a int map equivalent to a square size*size +** Function to bruteforce with backtracking for smallest square */ -unsigned int *initialize_map(int size) -{ - unsigned int *map[0]; - - while (size--) - map[size] = 0; - return (map); -} - -/* -** Function that bruteforce with backtracking for smallest square -*/ - -int *get_smallest_square(t_fillist list, int size, unsigned int map[]) +int *get_smallest_square(t_fillist list, int size, unsigned int map[]) { unsigned int mask; int i; diff --git a/handle_errors.c b/handle_errors.c index 94d5932..9d514ef 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/04/23 14:05:16 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/27 15:06:26 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -54,8 +54,8 @@ int check_file_errors(char *file) /* ** Function that check if tetrimino square contains: -** - 4 '#' -** - 12 '.' +** - 4 x # +** - 12 x . */ int check_tetri_errors(char *tetri) @@ -81,7 +81,7 @@ int check_tetri_errors(char *tetri) } /* -** Function that check if tetrimino parts are linked +** Function that check if 4 # (tetrimino parts) are linked */ int check_tetri_errors_proxy(char *tetri) diff --git a/main.c b/main.c index 725ea18..1acf5da 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */ -/* Updated: 2019/04/27 14:47:35 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/27 15:14:37 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -29,6 +29,6 @@ int main(int argc, char **argv) */ } else - print_error("Usage: Please submit a file.\n"); + print_error("Usage: Please submit a file.\n>>> ./fillit file.fillit\n"); return (0); } diff --git a/parse_input.c b/parse_input.c index 329351f..99a4095 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/04/27 02:04:18 by hulamy ### ########.fr */ +/* Updated: 2019/04/27 15:15:53 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,7 @@ /* ** DELETE BEFORE EVAL - TEST FUNCTION -** prints a ligne of size bits +** Prints a ligne of size bits */ void print_bits(unsigned int bits, int size) @@ -33,7 +33,7 @@ void print_bits(unsigned int bits, int size) /* ** DELETE BEFORE EVAL - TEST FUNCTION -** print a map of height and width +** Print a map of height and width */ void print_map(unsigned int *tab, int width, int height) @@ -58,7 +58,7 @@ void print_map(unsigned int *tab, int width, int height) } /* -** function that transform a tab of . and # into a binary tab of int +** Function that transform a tab of . and # into a binary tab of int */ unsigned short tab_to_bin(char line[]) @@ -80,7 +80,8 @@ unsigned short tab_to_bin(char line[]) } /* -** function that take a tetrimino of 4*4 and reduce it to its right size, in binary +** Function that take a tetrimino of 4*4 +** and reduce it to its right size, in binary */ unsigned short reduce_tetri(unsigned short tetri, int width) @@ -187,4 +188,3 @@ void parse_input(char *input) i++; } } -