basic corrections
This commit is contained in:
10
Makefile
10
Makefile
@@ -6,7 +6,7 @@
|
|||||||
# By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ #
|
# By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2019/03/01 13:24:35 by vmanzoni #+# #+# #
|
# Created: 2019/03/01 13:24:35 by vmanzoni #+# #+# #
|
||||||
# Updated: 2019/04/12 22:33:31 by vmanzoni ### ########.fr #
|
# Updated: 2019/04/14 14:21:26 by vmanzoni ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
@@ -28,18 +28,18 @@ CC = gcc
|
|||||||
|
|
||||||
CFLAGS = -Wall -Werror -Wextra
|
CFLAGS = -Wall -Werror -Wextra
|
||||||
|
|
||||||
RM = rm -f
|
RM = rm -rf
|
||||||
|
|
||||||
all: $(NAME)
|
all: $(NAME)
|
||||||
|
|
||||||
$(NAME)
|
$(NAME):
|
||||||
$(CC) $(CFLAGS) -I$(HEADER) -c $(addprefix $(SRC_DIR), $(SRCS))
|
$(CC) $(CFLAGS) -I$(HEADER) -c $(addprefix $(SRC_DIR), $(SRCS))
|
||||||
$(CC) $(OBJS) -o $(NAME)
|
$(CC) $(OBJS) -o $(NAME)
|
||||||
mkdir $(OBJ_DIR)
|
mkdir $(OBJ_DIR)
|
||||||
mv *.o $(OBJ_DIR)
|
mv $(OBJS) $(OBJ_DIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(OBJS)
|
$(RM) $(OBJ_DIR)
|
||||||
|
|
||||||
fclean: clean
|
fclean: clean
|
||||||
$(RM) $(NAME)
|
$(RM) $(NAME)
|
||||||
|
|||||||
129
samples/26tetri
Normal file
129
samples/26tetri
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
134
samples/27tetri
Normal file
134
samples/27tetri
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
10
samples/2nl
Normal file
10
samples/2nl
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
|
||||||
|
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
|
...#
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
...#
|
|
||||||
...#
|
|
||||||
...#
|
|
||||||
...#
|
|
||||||
|
|
||||||
....
|
|
||||||
....
|
|
||||||
....
|
|
||||||
####
|
|
||||||
|
|
||||||
.###
|
|
||||||
...#
|
|
||||||
....
|
|
||||||
....
|
|
||||||
|
|
||||||
....
|
|
||||||
..##
|
|
||||||
.##.
|
|
||||||
....
|
|
||||||
@@ -6,13 +6,15 @@
|
|||||||
/* 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/14 12:02:22 by vmanzoni ### ########.fr */
|
/* Updated: 2019/04/14 14:17:47 by vmanzoni ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "../includes/fillit.h"
|
#include "../includes/fillit.h"
|
||||||
|
|
||||||
char *get_smallest_square(/*args*/)
|
/*
|
||||||
|
char *get_smallest_square()
|
||||||
{
|
{
|
||||||
/*backtracking*/
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -6,17 +6,28 @@
|
|||||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */
|
/* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */
|
||||||
/* Updated: 2019/04/14 12:35:46 by vmanzoni ### ########.fr */
|
/* Updated: 2019/04/14 14:16:01 by vmanzoni ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "../includes/fillit.h"
|
#include "../includes/fillit.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Function that display error message *s on fd
|
||||||
|
*/
|
||||||
|
|
||||||
void ft_display_error(char *s, int fd)
|
void ft_display_error(char *s, int fd)
|
||||||
{
|
{
|
||||||
write(fd, s, strlen(s));
|
write(fd, s, strlen(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Function to see if there if an error if the file
|
||||||
|
** - less than 4 lines
|
||||||
|
** - more than 104 (26 tetri) + 25 (\n) = 129 lines
|
||||||
|
** - two \n in a row
|
||||||
|
*/
|
||||||
|
|
||||||
int ft_file_errors(char *file)
|
int ft_file_errors(char *file)
|
||||||
{
|
{
|
||||||
int line_nbr;
|
int line_nbr;
|
||||||
@@ -27,8 +38,9 @@ int ft_file_errors(char *file)
|
|||||||
if (*file == '\n')
|
if (*file == '\n')
|
||||||
line_nbr++;
|
line_nbr++;
|
||||||
file++;
|
file++;
|
||||||
|
if (*file == '\n')
|
||||||
|
return (1);
|
||||||
}
|
}
|
||||||
/*less than 4 lines or more than 104 (26 tetri) + 25 = 129 lines*/
|
|
||||||
if (line_nbr < 4 || line_nbr > 129)
|
if (line_nbr < 4 || line_nbr > 129)
|
||||||
return (1);
|
return (1);
|
||||||
return (0);
|
return (0);
|
||||||
|
|||||||
25
srcs/main.c
25
srcs/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/14 12:44:14 by vmanzoni ### ########.fr */
|
/* Updated: 2019/04/14 14:17:22 by vmanzoni ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -15,23 +15,13 @@
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char *input;
|
char *input;
|
||||||
short i;
|
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc == 2)
|
||||||
{
|
|
||||||
ft_display_error("Error: Please submit a file.\n", 2);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
else if (!(input = read_file(argv[1])))
|
|
||||||
{
|
{
|
||||||
|
if (!(input = read_file(argv[1])))
|
||||||
ft_display_error("Error: Could not read file.\n", 2);
|
ft_display_error("Error: Could not read file.\n", 2);
|
||||||
return (0);
|
if (ft_file_errors(input))
|
||||||
}
|
|
||||||
else if (ft_file_errors(input))
|
|
||||||
{
|
|
||||||
ft_display_error("Error: Invalid file.\n", 2);
|
ft_display_error("Error: Invalid file.\n", 2);
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
Check if every tetrimino is valid
|
Check if every tetrimino is valid
|
||||||
Transform input to tetriminos
|
Transform input to tetriminos
|
||||||
@@ -39,6 +29,9 @@ int main(int argc, char **argv)
|
|||||||
Transform tetriminos with letters
|
Transform tetriminos with letters
|
||||||
Print result
|
Print result
|
||||||
*/
|
*/
|
||||||
print_test(input);
|
}
|
||||||
return (0);
|
else
|
||||||
|
ft_display_error("Error: Please submit a file.\n", 2);
|
||||||
|
return (0);
|
||||||
|
print_test(input);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/04/13 12:09:46 by vmanzoni #+# #+# */
|
/* Created: 2019/04/13 12:09:46 by vmanzoni #+# #+# */
|
||||||
/* Updated: 2019/04/14 12:08:12 by vmanzoni ### ########.fr */
|
/* Updated: 2019/04/14 14:23:24 by vmanzoni ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* tetri_to_letters.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2019/04/12 22:31:30 by vmanzoni #+# #+# */
|
|
||||||
/* Updated: 2019/04/14 12:08:58 by vmanzoni ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "../includes/fillit.h"
|
|
||||||
|
|
||||||
char *tetri_to_letters()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user