Posts: 3,324
Threads: 96
Joined: Sep 2013
Quote:
Originally Posted by ******
From what you've written, I don't think what you want is possible at all with y_iterate, as it doesn't work the way you seem to think it does. Values ARE indexes, so if you randomly select the value "4" from one iterator, that is stored at index "4", and getting a value from the same slot in a different iterator will get you exactly the same value.
|
Oh I guess you're right, I always thought it stored the values in the iterator.
Quote:
Originally Posted by Misiur
For future reference, there is a way without collection of iterators:
pawn Код:
new Matrix[X_SIZE][Y_SIZE], Iterator:Matrix<X_SIZE * Y_SIZE> ;
public OnGameModeInit() { //Example cells: for(new x = 0; x != 3; ++x) { for(new y = 0; y != 3; ++y) { Matrix[x][y] = x * y; Iter_Add(Matrix, x * Y_SIZE + y); } }
//Retrieving random cell: new rnd = Iter_Random(Matrix), x = rnd / Y_SIZE, y = rnd % Y_SIZE ; printf("Cell at (%d, %d) value is equal %d", x, y, Matrix[x][y]);
return 1; }
|
Ok, what I need now is a way to get frontier cells only.