random, Graphics point ,searching- algorithm, via dual for loop set
- by LoneXcoder
hello and thanks for joining me in my journey to the custom made algorithm
for "guess where the pixel is"
this for Loop set (over Point.X, Point.Y), is formed in consecutive/linear form:
//Original\initial Location
Point initPoint = new Point(150, 100);
// No' of pixels to search left off X , and above Y
int preXsrchDepth, preYsrchDepth;
// No' of pixels to search to the right of X, And Above Y
int postXsrchDepth, postYsrchDepth;
preXsrchDepth = 10; // will start search at 10 pixels to the left from original X
preYsrchDepth = 10; // will start search at 10 pixels above the original Y
postXsrchDepth = 10; // will stop search at 10 pixels to the right from X
postYsrchDepth = 10; // will stop search at 10 pixels below Y
int StopXsearch = initPoint.X + postXsrchDepth; //stops X Loop itarations at initial pointX + depth requested to serch right of it
int StopYsearch = initPoint.Y + postYsrchDepth; //stops Y Loop itarations at initial pointY + depth requested below original location
int CountDownX, CountDownY; // Optional not requierd for loop but will reports the count down how many iterations left (unless break; triggerd ..uppon success)
Point SearchFromPoint = Point.Empty; //the point will be used
for (int StartX = initPoint.X - preXsrchDepth; StartX < StopXsearch; StartX++)
{
SearchFromPoint.X = StartX;
for (int StartY = initPoint.Y - preYsrchDepth; StartY < StpY; StartY++)
{
CountDownX = (initPoint.X - StartX);
CountDownY=(initPoint.Y - StartY);
SearchFromPoint.Y = StartY;
if (SearchSuccess)
{
same = true;
AAdToAppLog("Search Report For: " + imgName + "Search Completed Successfully On Try " + CountDownX + ":" + CountDownY);
break;
}
}
}
<-10 ---- -5--- -1 X +1--- +5---- +10
what i would like to do is try a way of instead
is have a little more clever approach
<+8---+5-- -8 -5 -- +2 +10 X -2 - -10 -8-- -6 ---1-
-3
|
+8
|
-10
Y
+1
-6
|
|
+9
....
I do know there's a wheel already invented in this field (even a full-trailer truck amount of wheels (: )
but as a new programmer,
I really wanted to start of with a simple way and also related to my field of interest in my project.
can anybody show an idea of his, he learnt along the way to Professionalism in algorithm /programming
having tests to do on few approaches (kind'a random cleverness...) will absolutely make the day and perhaps help some others viewing this page in the future to come
it will be much easier for me to understand if you could use as much as possible similar
naming to variables i used or implenet your code example ...it will be Greatly appreciated if used with my code sample, unless my metod is a realy flavorless.
p.s
i think that(atleast as human being) the tricky part is when throwing inconsecutive numbers you loose track of what you didn't yet use, how do u take care of this too .
thanks allot in advance looking forward to your participation !