Homework: TETRIS (2)

  1. Extend your previous homework about TETRIS.
  2. Design a function void draw_block(int n, int y0, int x0) which will draw the nth block at position (y0, x0) in its default color.
  3. Design a function void erase_block(int n, int y0, int x0) which will draw the nth block at position (y0, x0) in COLOR_PAIR(0), which effectively erase the block.
  4. In your main program, use a loop to demonstrate these two fucntions are working correctly.
    
        for (i=1; i<=7; i++)
        {
            for (int y=0; y<20; y++)
            {
                draw_block(i, y, i);
                refresh();
                usleep(300000);
                erase_block(i, y, i);
            }
        }