v0.1 parse_input
Not tested
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* 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 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 (1);
|
||||||
return (0);
|
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);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -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 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 parse_input(char *input)
|
||||||
{
|
{
|
||||||
int i;
|
char /*NOM DE LA VARIABLE*/;
|
||||||
int j;
|
int c;
|
||||||
int nl;
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
i = 0;
|
c = 0;
|
||||||
nl = 0;
|
while (input[c])
|
||||||
while (input[i])
|
|
||||||
{
|
{
|
||||||
j = 0;
|
i = 0;
|
||||||
while (j != 4)
|
while (i < 4)
|
||||||
{
|
{
|
||||||
square[j][] =
|
j = 0;
|
||||||
j++;
|
while (j < 4)
|
||||||
|
{
|
||||||
|
/*NOM DE LA VARIABLE[j]*/ = input[c++];
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
c++;
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
|
c++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user