From 5d6b2b0db3d8a8c3e2095635a4043189d6c21af9 Mon Sep 17 00:00:00 2001 From: Manzovince Date: Sun, 14 Apr 2019 18:55:27 +0200 Subject: [PATCH] v0.1 parse_input Not tested --- srcs/handle_errors.c | 40 +++++++++++++++++++++++++++++++++++++++- srcs/read_file.c | 29 ++++++++++++++++++----------- 2 files changed, 57 insertions(+), 12 deletions(-) diff --git a/srcs/handle_errors.c b/srcs/handle_errors.c index a149b54..aa6652d 100644 --- a/srcs/handle_errors.c +++ b/srcs/handle_errors.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */ -/* Updated: 2019/04/14 17:53:24 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/14 18:40:49 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -49,3 +49,41 @@ int check_file_errors(char *file) 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); +} +*/ diff --git a/srcs/read_file.c b/srcs/read_file.c index 6ed8b27..b67d965 100644 --- a/srcs/read_file.c +++ b/srcs/read_file.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/04/13 12:09:46 by vmanzoni #+# #+# */ -/* Updated: 2019/04/14 18:03:20 by vmanzoni ### ########.fr */ +/* Updated: 2019/04/14 18:54:53 by vmanzoni ### ########.fr */ /* */ /* ************************************************************************** */ @@ -46,19 +46,26 @@ char *read_file(char *file) int parse_input(char *input) { - int i; - int j; - int nl; + char /*NOM DE LA VARIABLE*/; + int c; + int i; + int j; - i = 0; - nl = 0; - while (input[i]) + c = 0; + while (input[c]) { - j = 0; - while (j != 4) + i = 0; + while (i < 4) { - square[j][] = - j++; + j = 0; + while (j < 4) + { + /*NOM DE LA VARIABLE[j]*/ = input[c++]; + j++; + } + c++; + i++; } + c++; } }