Mark Horizontal Lines
- In the TETRIS game, when a horizontal line is filled up with
tetrominoes so that there is no gap, this line can be removed.
- However, this is a complex procedure, so let us divide it into
several smaller sub-tasks. This "Divide
and Conquer" strategy will be very helpful for you to design a complicated
algorithm.
- In our case, we shall design several functions which, when combined
together, will clear a horizontal line when there is no gap.
- In this exercise, let us first design a function
check_horizontal(int i), which will check whether all elements in the row
occupied[i] are true.
-
After you invoke update_occupy(),
invoke check_horizontal(i) for each line.
If it returns true, mark the line(s) with a string "->".