Example #1
0
    void make_unique(points_t& pts)
    {
	    std::sort(pts.begin(),pts.end(),less_point_pr());
	    pts.erase(
		    std::unique(pts.begin(),pts.end()),
		    pts.end());
    }
Example #2
0
	void field_t::get_empty_around(const point& c,points_t& res,int bound_size) const
	{
		res.resize(0);
		for(int y=c.y-bound_size;y<=c.y+bound_size;y++)
		for(int x=c.x-bound_size;x<=c.x+bound_size;x++)
		{
			point p(x,y);
			if(at(p)==st_empty)
				res.push_back(p);
		}

		std::sort(res.begin(),res.end(),less_point_pr());
		res.erase(std::unique(res.begin(),res.end()),res.end());
	}
Example #3
0
	void field_t::get_empty_around(points_t& res,int bound_size) const
	{
		res.resize(0);
		for(unsigned i=0;i<steps.size();i++)
		{
			const step_t& st=steps[i];
			for(int y=st.y-bound_size;y<=st.y+bound_size;y++)
			for(int x=st.x-bound_size;x<=st.x+bound_size;x++)
			{
				point p(x,y);
				if(at(p)==st_empty)
					res.push_back(p);
			}
		}

		std::sort(res.begin(),res.end(),less_point_pr());
		res.erase(std::unique(res.begin(),res.end()),res.end());
	}