Few edits + BUG found on tmp (add_to_list) with some tetriminoes
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/04/14 15:20:53 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"
|
//#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)
|
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)
|
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
|
** Print octet
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -94,6 +97,7 @@ void print_test(int octet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
** DELETE BEFORE EVAL - TEST FUNCTION
|
||||||
** Test
|
** Test
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -127,7 +131,7 @@ void test(unsigned int map[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** MAIN FOR TEST
|
** DELETE BEFORE EVAL - MAIN FOR TEST
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
2
fillit.h
2
fillit.h
@@ -6,7 +6,7 @@
|
|||||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/03/01 13:34:46 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 */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,16 @@
|
|||||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/04/12 22:29:45 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"
|
#include "fillit.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Function that initialize a int map equivalent to a square size*size
|
||||||
|
*/
|
||||||
|
|
||||||
unsigned int *initialize_map(int size)
|
unsigned int *initialize_map(int size)
|
||||||
{
|
{
|
||||||
unsigned int *map[0];
|
unsigned int *map[0];
|
||||||
@@ -23,6 +27,10 @@ unsigned int *initialize_map(int size)
|
|||||||
return (map);
|
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;
|
unsigned int mask;
|
||||||
|
|||||||
2
main.c
2
main.c
@@ -6,7 +6,7 @@
|
|||||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/02/12 13:20:48 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 */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/04/15 14:48:14 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))
|
if (check_tetri_errors(tetri))
|
||||||
print_error("Error: Tetrimino not valid.");
|
print_error("Error: Tetrimino not valid.");
|
||||||
add_to_list(tetri, &list);
|
add_to_list(tetri, &list);
|
||||||
|
printf("added to list !!\n");
|
||||||
while (input[i] && input[i] != '.' && input[i] != '#')
|
while (input[i] && input[i] != '.' && input[i] != '#')
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|||||||
9
samples/2tetri
Normal file
9
samples/2tetri
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
....
|
||||||
|
##..
|
||||||
|
.##.
|
||||||
|
....
|
||||||
14
samples/3tetri
Normal file
14
samples/3tetri
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
....
|
||||||
|
##..
|
||||||
|
.##.
|
||||||
|
....
|
||||||
|
|
||||||
|
....
|
||||||
|
###.
|
||||||
|
.#..
|
||||||
|
....
|
||||||
19
samples/4tetri
Normal file
19
samples/4tetri
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
@@ -111,4 +111,4 @@
|
|||||||
....
|
....
|
||||||
....
|
....
|
||||||
####
|
####
|
||||||
....iskjdslkfsljklfdjk
|
....i
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
|
#...
|
||||||
|
###.
|
||||||
....
|
....
|
||||||
....
|
....
|
||||||
....
|
|
||||||
####
|
|
||||||
Reference in New Issue
Block a user