However, this makes NO SENSE at all:
You define a local variable t that goes out of scope right away. (This happens more than once in your code).
Now one thing about efficiency. You have this nested loop (a few times):
Code:
for (int a=0; a<250; a++)
{
for (int b=0; b<250; b++)
{
if (island[125-y][x+124]>island[a][b])
{t=0;}
}
}
Note that inner part is executed 62,500 times.
Note also that after the very first time you set t to 0, the rest of those loops can’t possibly make any difference. See if you can break out of there.
This whole thing is triple-nested into
Code:
for(int i=0;i<n_walks;i++)// 'FOR' STATEMENT IS A TYPE OF LOOP
{
for (int f=125; f>-116; f=f-10)
{
for (int g=125; g>-116; g=g-10)
{
which produces 500,000 * 25 * 25 = 312,500,000 iterations of the previous fragment. No wonder it takes long time!
Could you please clean up you code and repost here for further analysis?