simple tetris script

is there a way to make a very simple 1 dot tetris script, that uses very few lines?

i was thinking of using arrays, and replacing the value with an integer which i would control via button press

for example:

int val = 0;

int TEST[] = 0, 1, 2, 3, 4....

( or however you put arrays in ) and replace a value inbetween the "[]" with val, and then set val to change from a button press.

so i want the script just to move 1 led, as a test, around a 5 x 7 screen. if possible, making it so the led's are connected to 2 shift registers. the ones i talk about so much... lol ( i believe 74hc sumthin ) and the movement is controlled by 4 buttons, that can be connected to any arduino pins, or maybe to make it intresting, using 2 potentiometers!

im very curious to hear what you guys come up with, and i'm really not sure how to approach this, so please, if you can, AYUDAME! ( or "help me" in spanish lol )


well if it is 1 dot tetris you will really only need two buttons, right and left because rotation of a single pixel is irrelevant

there is some sample code here,on a tetris engine... I havent read it, but google can be your fiend for things like this.

It is really just the simplest form of collision detection.

ok, how about this;

can i make an array and then call back an integer from the array buy pressing the button?

so like an example:
this isint real code, but go with it…;

array is “ledarray 1-9”
and i make it so val is 0
and one button press makes val ++ by 1, and another button makes val – by 1
and then i make “ledarray[val]”

can i make ledarray bring up the led value by the val?

and of course with a matrix, i would need to turn it into coordinates, instead of only left and right…

many ways to do this, this is off the top of my head

a two dim array for the entire board

start with your pixels off screen position, somewhere at max x +1,y ... randomize y

before moving your pixel check the position x,y-1 against the two dim array.

if that spot is empty, set the position to x,y-1 else add x,y to arraylist reset pixel position to top value(max x +1, random y)

refresh the leds to display your 2 dim array

then use interrupts for button pushes... should just modfy the x value... you can decide if it wraps or the right/left edges are boundraies.....

actually this is starting to sound interesting to me....

maybe two of these stacked for the leds?