diff --git a/add_to_list.c b/add_to_list.c index 9a0ad48..fd7d130 100644 --- a/add_to_list.c +++ b/add_to_list.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/04/14 15:20:53 by hulamy #+# #+# */ -/* Updated: 2019/04/23 16:15:10 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/23 21:04:43 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,7 +15,8 @@ //#include "libft/includes/libft.h" /* -** this function prints a 16 bites short +** DELETE BEFORE EVAL - TEST FUNCTION +** Function that prints a 16 bites short */ void print_bits(short line) @@ -59,7 +60,8 @@ int fill_list(char line[], t_fillist *list) } /* -** this function create the linked list and add a new structure linked each time needed +** Function that create the linked list and add a new structure +** linked each time needed */ int add_to_list(char *line, t_fillist **list) @@ -78,6 +80,7 @@ int add_to_list(char *line, t_fillist **list) } /* +** DELETE BEFORE EVAL - TEST FUNCTION ** Print octet */ @@ -94,6 +97,7 @@ void print_test(int octet) } /* +** DELETE BEFORE EVAL - TEST FUNCTION ** Test */ @@ -127,7 +131,7 @@ void test(unsigned int map[]) } /* -** MAIN FOR TEST +** DELETE BEFORE EVAL - MAIN FOR TEST */ /* diff --git a/fillit.h b/fillit.h index c80544f..0fbd67c 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/23 14:25:15 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/23 16:19:19 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/get_smallest_square.c b/get_smallest_square.c index 9ac5ca1..399d74e 100644 --- a/get_smallest_square.c +++ b/get_smallest_square.c @@ -6,12 +6,16 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/04/12 22:29:45 by vmanzoni #+# #+# */ -/* Updated: 2019/04/23 14:34:32 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/23 21:03:10 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ #include "fillit.h" +/* +** Function that initialize a int map equivalent to a square size*size +*/ + unsigned int *initialize_map(int size) { unsigned int *map[0]; @@ -23,6 +27,10 @@ unsigned int *initialize_map(int size) return (map); } +/* +** Function that bruteforce with backtracking for smallest square +*/ + int *get_smallest_square(t_fillist list, int size, unsigned int map[]) { unsigned int mask; diff --git a/main.c b/main.c index 47cdfd7..77afdd6 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/22 15:50:16 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/23 16:19:17 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/parse_input.c b/parse_input.c index 8852298..f5f88cc 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/23 16:01:12 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/23 21:09:40 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -34,6 +34,7 @@ void parse_input(char *input) if (check_tetri_errors(tetri)) print_error("Error: Tetrimino not valid."); add_to_list(tetri, &list); + printf("added to list !!\n"); while (input[i] && input[i] != '.' && input[i] != '#') i++; } diff --git a/samples/2tetri b/samples/2tetri new file mode 100644 index 0000000..26e4931 --- /dev/null +++ b/samples/2tetri @@ -0,0 +1,9 @@ +...# +...# +...# +...# + +.... +##.. +.##. +.... diff --git a/samples/3tetri b/samples/3tetri new file mode 100644 index 0000000..84fea70 --- /dev/null +++ b/samples/3tetri @@ -0,0 +1,14 @@ +...# +...# +...# +...# + +.... +##.. +.##. +.... + +.... +###. +.#.. +.... diff --git a/samples/4tetri b/samples/4tetri new file mode 100644 index 0000000..98a0c27 --- /dev/null +++ b/samples/4tetri @@ -0,0 +1,19 @@ +...# +...# +...# +...# + +...# +...# +...# +...# + +...# +...# +...# +...# + +...# +...# +...# +...# diff --git a/samples/difficile_ou_pas b/samples/difficile_ou_pas index aac9474..d0c08a8 100644 --- a/samples/difficile_ou_pas +++ b/samples/difficile_ou_pas @@ -111,4 +111,4 @@ .... .... #### -....iskjdslkfsljklfdjk +....i diff --git a/samples/one b/samples/test_bug similarity index 50% rename from samples/one rename to samples/test_bug index 5013175..0e8a3bd 100644 --- a/samples/one +++ b/samples/test_bug @@ -1,4 +1,4 @@ +#... +###. .... .... -.... -####