rien ne marche...
This commit is contained in:
@@ -6,36 +6,29 @@
|
|||||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2019/04/14 15:20:53 by hulamy #+# #+# */
|
/* Created: 2019/04/14 15:20:53 by hulamy #+# #+# */
|
||||||
/* Updated: 2019/04/14 17:30:57 by hulamy ### ########.fr */
|
/* Updated: 2019/04/14 19:11:50 by hulamy ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "../includes/fillit.h"
|
#include "../includes/fillit.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
void find_start_to_end(char **square, int *x1, int *x2, int *y1, int *y2)
|
int find_start_and_end(char *square)
|
||||||
{
|
{
|
||||||
while (*y1 == 4 && !(*y1 = 0) && square[++(*x1)][0] != '#')
|
int i;
|
||||||
while (*y1 < 4 && square[*x1][*y1] != '#')
|
|
||||||
(*y1)++;
|
i = -1;
|
||||||
while (*y2 == 0 && (*y2 = 3) && square[--(*x2)][3] != '#')
|
while (++i < 4)
|
||||||
while (*y2 > 0 && square[*x2][*y2] != '#')
|
printf("%c",square[0] + i);
|
||||||
(*y2)--;
|
return (i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reduce_tetraminos(char **square, t_fillist *list)
|
void reduce_tetraminos(char **square, t_fillist *list)
|
||||||
{
|
{
|
||||||
int x1;
|
int start;
|
||||||
int x2;
|
|
||||||
int y1;
|
|
||||||
int y2;
|
|
||||||
|
|
||||||
x1 = -1;
|
start = find_start_and_end(square[1]);
|
||||||
x2 = 4;
|
(void)list;
|
||||||
y1 = 4;
|
|
||||||
y2 = 0;
|
|
||||||
find_start_to_end(square, &x1, &x2, &y1, &y2);
|
|
||||||
printf("de [%d,%d] a [%d,%d]\n",x1, y1, x2, y2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int add_to_list(char **square)
|
int add_to_list(char **square)
|
||||||
@@ -43,7 +36,6 @@ int add_to_list(char **square)
|
|||||||
t_fillist *list;
|
t_fillist *list;
|
||||||
|
|
||||||
square++;
|
square++;
|
||||||
printf("square[0] : %s\n", square[0]);
|
|
||||||
if (!(list = (t_fillist*)malloc(sizeof(*list))))
|
if (!(list = (t_fillist*)malloc(sizeof(*list))))
|
||||||
return (0);
|
return (0);
|
||||||
reduce_tetraminos(square, list);
|
reduce_tetraminos(square, list);
|
||||||
|
|||||||
Reference in New Issue
Block a user