예제 #1
0
파일: main.c 프로젝트: Marrylup/Piscine42_C
void	ft_test(char **tab, t_copy tab2)
{
	int	i;
	int	ok;
	int	k;

	ok = 0;
	i = 0;
	while (i <= 4)
	{
		ft_put_colle(i, &tab2);
		if (ft_tabcmp(tab, tab2.tab))
		{
			k = -1;
			ft_result(i, tab2.c, tab2.l, ok);
			ok = 1;
		}
		i++;
	}
	if (ok == 0)
		ft_putstr("aucune");
	if (tab2.c <= 1)
		ok = 0;
	ft_free(tab, ok);
	ft_free(tab2.tab, ok);
}
예제 #2
0
int			ft_check_win(t_env *env)
{
	int x;
	int y;
	int i;

	x = 0;
	i = 0;
	while (x < 4)
	{
		y = 0;
		while (y < 4)
		{
			if ((env->squares[y][x] == WIN_1 && !env->win_0)\
					|| env->squares[y][x] == WIN_2)
				i = env->squares[y][x] == WIN_1 ? 1 : 2;
			y++;
		}
		x++;
	}
	return (ft_result(i, env));
}
예제 #3
0
파일: main.c 프로젝트: svelhinh/42_stages
int				main(int ac, char **av)
{
	t_coord	**coord;
	t_varf	v;

	(ac != 2) ? (ft_exit()) : (0);
	v.tab = NULL;
	v.file = ft_strnew(1);
	((v.fd = open(av[1], O_RDONLY)) == -1) ? (ft_exit()) : (0);
	ft_check_tetri(v.fd);
	(close(v.fd) == -1) ? (ft_exit()) : (0);
	((v.fd = open(av[1], O_RDONLY)) == -1) ? (ft_exit()) : (0);
	ft_errors(v.fd, &v.file);
	(close(v.fd) == -1) ? (ft_exit()) : (0);
	v.file = ft_letters(v.file);
	coord = ft_store(v.file);
	free(v.file);
	v.tab = ft_result(*coord, ft_nbr_blk(*coord));
	free(coord);
	ft_display(v.tab);
	free(v.tab);
	return (0);
}