#include <bits/stdc++.h>
using namespace std;
map<int, list<int> > mymap;
map<int, list<int> >::iterator it;
void showallpoints(map<int, list<int> >& mymap)
{
for (it = mymap.begin(); it != mymap.end(); it++) {
list<int> temp = it->second;
for (auto p = temp.begin(); p != temp.end(); p++) {
cout << "(" << it->first << ", " << *p << ")\n";
}
}
}
void putpixelone(int m, int n, map<int, list<int> >& mymap)
{
map<int, list<int> >::iterator it;
if (mymap.find(m) != mymap.end()) {
it = mymap.find(m);
list<int> temp = it->second;
list<int>::iterator p;
for (p = temp.begin(); p != temp.end(); p++)
if (*p == n)
return;
mymap[m].push_back(n);
} else
mymap[m].push_back(n);
return;
}
void putpixelall(int p, int q, int x1, int y1)
{
putpixelone(p + x1, q + y1, mymap);
putpixelone(q + x1, p + y1, mymap);
putpixelone(q + x1, -p + y1, mymap);
putpixelone(p + x1, -q + y1, mymap);
putpixelone(-p + x1, -q + y1, mymap);
putpixelone(-q + x1, -p + y1, mymap);
putpixelone(-q + x1, p + y1, mymap);
putpixelone(-p + x1, q + y1, mymap);
return;
}
void circle(int centerx, int centery, int r)
{
int x = 0;
int y = r;
float decision_para = 3 - 2 * (r);
putpixelall(x, y, centerx, centery);
while (x < y) {
x = x + 1;
if (decision_para <= 0) {
decision_para = decision_para + 4 * x + 6;
} else {
y = y - 1;
decision_para = decision_para + 4 * (x - y) + 10;
}
putpixelall(x, y, centerx, centery);
}
return;
}
void neighbours(map<int, list<int> >& mymap, int given_pointx,
int given_pointy)
{
for (it = mymap.begin(); it != mymap.end(); ++it) {
if (it->first == given_pointx + 1 ||
it->first == given_pointx - 1) {
list<int> temp1 = it->second;
list<int>::iterator itr1;
for (itr1 = temp1.begin(); itr1 != temp1.end(); ++itr1) {
if (given_pointy >= 0 && *itr1 >= 0)
cout << "(" << it->first << ", " << *itr1 << ")\n";
else if (given_pointy <= 0 && *itr1 <= 0)
cout << "(" << it->first << ", " << *itr1 << ")\n";
else
continue;
}
}
}
}
int main()
{
int center_x = 0, center_y = 0;
float r = 3.0;
circle(center_x, center_y, r);
showallpoints(mymap);
int nx = 3, ny = 0;
neighbours(mymap, nx, ny);
cout << endl;
return 0;
}