One Tetromino Lookahead

  1. Some players suggest that it will be easier for them to arrange the locations of tetrominoes if they can foresee the next tetromino to appear.
    Lookahead
  2. This is actually easy. You don't need to modify the definition of your CTetromino class (tetris.h) at all. You only need to add a small feature to handle this in your main program.
  3. For instance, you used to randomly generate an integer i = rand() % nType as the type_id of the new tetromino. Now you do that in two steps:
    1. i = next_i;
      next_i = rand() % nType;
    2. Construct a new tetromino with i.
  4. By inspecting the value of next_i, you knows the type_id of the next tetromino (its value is still randomly generated). You may draw it at an appropriate corner to give the player a hint.