Few edits for readability, cleaning + README edit
This commit is contained in:
6
Makefile
6
Makefile
@@ -6,7 +6,7 @@
|
||||
# By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# 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
|
||||
|
||||
@@ -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
|
||||
|
||||
4
fillit.h
4
fillit.h
@@ -6,7 +6,7 @@
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <stdio.h> // for printf (DELETE BEFORE EVAL)
|
||||
|
||||
#include "../42-libft/includes/libft.h"
|
||||
# define BUFF_SIZE 1024
|
||||
//# define BUFF_SIZE 1024
|
||||
|
||||
/*
|
||||
** STRUCTURE
|
||||
|
||||
@@ -6,30 +6,17 @@
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
|
||||
4
main.c
4
main.c
@@ -6,7 +6,7 @@
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user