Array is 40 by 40 so [0 - 39][0 - 39].
is there a way that I can go through the array and select every item without selecting an item twice but do it randomly, so no a loop like for(i = 0; i < 40; i ++). sorry if my explanation is bad
Converted the array into a 1d Array
newArray = [];
for (var i = 0; i < gridsize; i ++) {
for (var j = 0; j < gridsize; j ++) {
newArray.push(grid[i][j])
}
}
newArray = shuffle(newArray)
then I'm going through the array like so
for (var x = 0; x < newArray.length; x ++) {
i = newArray[x].x
j = newArray[x].y
switch(grid[i][j].id) {
so that Because the array has been shuffled I can get a new random spot to search, is there a more efficient way than this?