Exemple #1
0
int			ft_filling(t_inv *move, int posi, char (*tab)[SIZE],
					char (*end)[SIZE])
{
	if (ft_backtrack(move, posi, tab, end) == 1)
	{
		ft_reboot(LTR, SIZE, tab);
		--LTR;
		if (posi < (SIZE * SIZE - 1))
			return (ft_filling(move, ++posi, tab, end));
		else if (ft_onlyp(SIZE, end) == 1 && LTR + 1 == 'A')
		{
			++SIZE;
			return (ft_fillit(move));
		}
	}
	else
	{
		ft_replacend(SIZE, tab, end);
		if (posi < (SIZE * SIZE - 1))
		{
			ft_reboot(LTR, SIZE, tab);
			return (ft_filling(move, ++posi, tab, end));
		}
	}
	--LTR;
	ft_reboot(++LTR + 1, SIZE, tab);
	--T;
	return (1);
}
Exemple #2
0
void		ft_try_put_piece(t_map *map, t_piece *piece, int y, int x)
{
	int		ytmp;
	int		xtmp;

	ytmp = -1;
	if (piece->y_size + y < map->bestsize && piece->x_size + x < map->bestsize)
	{
		while (++ytmp < piece->y_size)
		{
			xtmp = -1;
			while (++xtmp < piece->x_size)
				if (map->actualcontent[y + ytmp][x + xtmp] != '.' &&
				piece->content[ytmp][xtmp] != '.')
					return ;
		}
		ft_put_piece(map, piece, y, x);
		ft_fillit(map);
		ft_clear_piece(map, piece, y, x);
	}
}