Storing cells in y_iterate.
#7

Quote:
Originally Posted by Crayder
Посмотреть сообщение
Thats almost exactly what I had, but wouldn't you subtract from rand? Doing so would remove the need to loop back to index one.
You shouldn't subtract from rand because foreach isn't linear, it uses the cells as indexes

An iterator could look like that (it is sorted ascending)
array[sizeof array] = 3 (Iter_First), array[3] = 5, array[5] = 7, array[7] = sizeof array [thats the end]

It is a one way ticket, it is better to use Iter_Next which is just "array[value]"

Actually I think we should use Iter_Begin instead of Iter_First, as we want the first index not the first value
pawn Код:
new rand = Iter_Random(Frontier[0]));

if(Iter_Next(Frontier[0], rand) == Iter_Size(Frontier[0])) {
    rand = Iter_Begin(Frontier[0]);
}
RandomCell[0] = Iter_Next(Frontier[0], rand);
RandomCell[1] = Iter_Next(Frontier[1], rand);
Reply


Messages In This Thread
Storing cells in y_iterate. - by Crayder - 09.03.2015, 18:33
Re: Storing cells in y_iterate. - by oliverrud - 09.03.2015, 20:42
Re: Storing cells in y_iterate. - by Misiur - 09.03.2015, 20:44
Re: Storing cells in y_iterate. - by Crayder - 09.03.2015, 21:17
AW: Storing cells in y_iterate. - by Nero_3D - 10.03.2015, 04:06
Re: AW: Storing cells in y_iterate. - by Crayder - 10.03.2015, 04:14
AW: Re: AW: Storing cells in y_iterate. - by Nero_3D - 10.03.2015, 13:18
Re: Storing cells in y_iterate. - by Misiur - 10.03.2015, 14:36
Re: Storing cells in y_iterate. - by Crayder - 10.03.2015, 21:24

Forum Jump:


Users browsing this thread: 1 Guest(s)