Folders deleted

This commit is contained in:
Manzovince
2019-04-14 21:39:40 +02:00
parent 5d6b2b0db3
commit 9d8940e6a5
7 changed files with 10 additions and 10 deletions

View File

@@ -1,20 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_smallest_square.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/12 22:29:45 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 14:17:47 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/fillit.h"
/*
char *get_smallest_square()
{
}
*/

View File

@@ -1,89 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* handle_errors.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 18:40:49 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/fillit.h"
/*
** Function that display error message *s on fd
*/
void print_error(char *s)
{
write(2, 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 check_file_errors(char *file)
{
int i;
int line_nbr;
i = 0;
line_nbr = 0;
while (file[i])
{
if (file[i] != '.' && file[i] != '#' && file[i] != '\n')
return (1);
if (file[i] == '\n')
line_nbr++;
if (file[i] == '\n' && file[i+1] == '\n')
return (1);
i++;
}
if (line_nbr < 4 || line_nbr > 129)
return (1);
return (0);
}
int check_tetri_errors(char *tetri)
{
int i;
int htg;
int dot;
i = 0;
htg = 0;
dot = 0;
while (tetri[i])
{
if (tetri[i] = '#')
htg++;
else if (tetri[i] = '.')
dot++;
}
if (htg != 4 || dot != 12 || check_tetri_errors2(tetri))
return (1);
return (0);
}
/*
int check_tetri_errors2(char *tetri)
{
int i;
i = 0;
while (tetri[i])
{
if (tetri[i] == '#')
{
}
}
return (0);
}
*/

View File

@@ -1,37 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/12 13:20:48 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 17:44:38 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/fillit.h"
int main(int argc, char **argv)
{
char *input;
if (argc == 2)
{
if (!(input = read_file(argv[1])))
print_error("Error: Could not read file.\n");
if (check_file_errors(input))
print_error("Error: Invalid file.\n");
/*
Check if every tetrimino is valid
Transform input to tetriminos
Backtracking for smallest square
Transform tetriminos with letters
Print result
*/
}
else
print_error("Error: Please submit a file.\n");
return (0);
print_test(input);
}

View File

@@ -1,25 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print_fillit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/03/01 13:35:48 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 12:13:16 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/fillit.h"
/*
void ft_print_fillit()
{
}
*/
void print_test(char *test)
{
write(1, test, strlen(test));
}

View File

@@ -1,71 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* read_file.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vmanzoni <vmanzoni@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/13 12:09:46 by vmanzoni #+# #+# */
/* Updated: 2019/04/14 18:54:53 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
#include "../includes/fillit.h"
/*
** Function that read and return a ptr to file
*/
char *read_file(char *file)
{
char buf[BUFF_SIZE];
int fd;
int rv;
int i;
char *result;
if (((fd = open(file, O_RDONLY)) < 0) \
|| ((rv = read(fd, &buf, BUFF_SIZE)) < 0) \
|| !(result = malloc(sizeof(char) * rv)))
return (NULL);
buf[rv] = '\0';
i = 0;
while (buf[i])
{
result[i] = buf[i];
i++;
}
result[i] = '\0';
close(fd);
return (result);
}
/*
** Function that parse a file and return each tetrimino
*/
int parse_input(char *input)
{
char /*NOM DE LA VARIABLE*/;
int c;
int i;
int j;
c = 0;
while (input[c])
{
i = 0;
while (i < 4)
{
j = 0;
while (j < 4)
{
/*NOM DE LA VARIABLE[j]*/ = input[c++];
j++;
}
c++;
i++;
}
c++;
}
}