I'm sure somewhere has this question been solved, but after 2 hours of search without finding the solution, I'm desperatly searching for your help.
There is position in an 2d-Array given and I want to search for the same value around this position. Now I dont want to use a double for-loop. I want to search around the position with an increasing circle. Example:
position is 0,0:
- search at 0,0;
- search at -5, 0;
- search at -5, -5;
- search at 0, -5;
- search at 5, -5;
- search at 5, 0;
- search at 5, 5;
- ....
When the circle is completed i want to increase the search radius from -5, 0; to -10, 5;
Main goal therefor ist not to search in a position, which has already been searched. I tried to implement it with for-loops or booleans but neither worked. Do you have an idea? I need to make it in C++, but any ideas are apreciated!
Thanks for your help and have a good day!