Array help...

BlitzMax Forums/BlitzMax Programming/Array help...

Dabz(Posted 2007) [#1]
I think I have spent too much time programming in the last week, because my brain has just died.

Basically, if I had a 2D array set up like so:-

00000
00000
00000
00200
32422

How could I shuffle the area so that it adds a row of 1's to the bottom, then upwards, e..g:-

00000
00000
00000
00200
32422

00000
00000
00200
32422
11111

00000
00200
32422
11111
11111

etc etc

cheers! :)

Dabz


Perturbatio(Posted 2007) [#2]
One way to do it (although probably not the most efficient)



Dabz(Posted 2007) [#3]
So simple, but I couldnt see it! :(

Thanks Perturbatio!

Dabz


Amon(Posted 2007) [#4]
Nice code. This will go in my working code folder for future reference. :)


Perturbatio(Posted 2007) [#5]
with an array of arrays it's much smaller (and a little easier to maintain)




Perturbatio(Posted 2007) [#6]


Cleaner still.


Dabz(Posted 2007) [#7]
Just poping into say thanks for the help Perturbatio! :)

I had brain rot the other day and just couldnt think, I guess that happens to everyone once in a while.

Cheers

Dabz


Perturbatio(Posted 2007) [#8]
no problem :)