Board Thread:Questions and Answers/@comment-24386245-20141019121348/@comment-5334617-20141019225207

I can give you some bits of code to get you started.

I'm assuming the playing area is a fixed size (or, has some fixed maximum size). If the area is 12 squares wide and 8 squares tall, you might declare

DIM GRID(12,8)

You now have a bunch ov variables, conveniently called,  ,   ...   ...  .  Note that the highest numbers in the variable names are one less than the numbers in the. That's because the 'indices' start counting at 0, not 1. When you start counting at 0, and you want a total of 8 numbers (the 8 in the ), you get 0 1 2 3 4 5 6 7.

A natural way to represent the status of the game at any time would be to store the value '0' in these new variables (called 'entries' in the array) for an empty square, and '1' and more for different colours. To empty the grid:

FOR X=0 TO 11 FOR Y=0 TO 7 GRID(X,Y)=0 NEXT Y NEXT X

To signify a block at grid coordinates, set the variable  to the colour of that block. To check whether the coordinates is empty, or contains a block, read the value of variable.

To check every horizontal trio of squares:

FOR X=0 TO 9 FOR Y=0 TO 7 ' Check GRID(X,Y) GRID(X+1,Y) GRID(X+2,Y) NEXT Y NEXT X

To check every vertical trio of squares:

FOR X=0 TO 11 FOR Y=0 TO 5 ' Check GRID(X,Y) GRID(X,Y+1) GRID(X,Y+2) NEXT Y NEXT X

Now, I imagine when blocks are 'broken' inside the grid, the blocks above fall. Say you want to remove 1 block from a column, at, and say that increasing y-values point down (like PTC graphics coordinates (unlike 99% of other systems' graphics coordinates)).

FOR Y1=Y-1 TO 0 STEP -1 GRID(X,Y1+1)=GRID(X,Y1) NEXT Y1 GRID(X,0)=0