   Storing blocks in a puzzle game
  Ive been thinking about coding another puzzle game, and the main problem I had with my first puzzle game, was that all the blocks were stored in a 10x10 grid, so when they moved around and got cleared, etc I had to switch the grid to pointing to blocks above it, and then tell those blocks to move to the correct possition.  It worked, but took about 400 lines of code because of all the special cases it had to take care of.  So I was wondering If this was the way most people stored their data, or did they just have, ex a linked list with all the blocks, and let them move freely, but then had to search through the list for the blocks around them when they were falling, etc?   
  Why are you advertising?   ;  Huh?   ;  The grid approach generally works well. There usually aren't that many "special cases". 400 lines of code isn't a big project (I find that in C++, 200 is about a minimum to get anything interesting done at all), but for a single task (e.g. updating the play field) it might be more than is called for.Put that part in a source box and I might be able to make some suggestions.   ;  This is the basic code, I have a seperate version with some changes for each side.checkexplode() checks a row for sets of 3 blocksFPSLIM is a macro for my FPS limiting codedebugp() prints debugging information to a text fileswitch(side){case TOP:// block.ny=40;block.x=40+pos*16-16;block.nx=block.x;block.y=6;//printf("1\n");for(i=0;i<10;i++){if(pos==0) dprint("errorz",13);if(level[pos-1].type!=0){    bloks[blocks]=i;debugp("bloks",blocks,bloks[blocks]);    blocks++;}}if(blocks==0){misses++;score[player]-=away;away++;block.ny=240;while(block.y<block.ny){ render();SDL_Flip(screen);FPSLIM}break;}h=0;block.ny=level[pos-1][bloks[0]].y;while(block.y<block.ny-16){render();SDL_Flip(screen);FPSLIM}blocks--;debugp("blocks",0,blocks);for(i=bloks[0];i<=bloks[blocks];i++){if(level[pos-1].type!=0)level[pos-1].ny+=16;else{h=i;i=11;}}debugp("h",0,h);while(block.y<block.ny){render();SDL_Flip(screen);FPSLIM}if(h){for(i=h;i>bloks[0];i--){    level[pos-1].type=level[pos-1][i-1].type;    level[pos-1].e=level[pos-1][i-1].e;    level[pos-1].y=i*16+40;level[pos-1].ny=level[pos-1].y;}level[pos-1][bloks[0]].type=block.type;level[pos-1][bloks[0]].e=0;level[pos-1][bloks[0]].y=(i)*16+40;level[pos-1][bloks[0]].ny=level[pos-1][bloks[0]].y;checkexplode(pos-1,-1);}else{h=level[pos-1][bloks[blocks]].type;for(i=bloks[blocks];i>=bloks[0];i--){    level[pos-1].type=level[pos-1][i-1].type;    level[pos-1].e=level[pos-1][i-1].e;    level[pos-1].y=i*16+40;level[pos-1].ny=level[pos-1].y;}level[pos-1][bloks[0]].type=block.type;level[pos-1][bloks[0]].e=0;block.type=h;block.y=level[pos-1][bloks[blocks]].y+20;block.ny=240;checkexplode(pos-1,-1);while(block.y<240){render();SDL_Flip(screen);FPSLIMdprint("rendering",side);}}break;It just seems like it shouldnt be this complicated.   