SVN / public / code / vorlesung-05 / Structure.TIP

Revision 11340
Date
Committeral38
Download
// Copyright 2016, University of Freiburg,
// Chair of Algorithms and Data Structures.
// Author: Hannah Bast <bast@cs.uni-freiburg.de>,
//         Axel Lehmann <lehmanna@cs.uni-freiburg.de>.

// NOTE: this is a code design suggestion in pseudo-code. It is not supposed to
// be compilable in any language. You have to translate it to C++ yourself. The
// purpose of this file is to suggest a basic design and settle questions you
// might have on what exactly your code is supossed to do.

// Class for the structure.
class Structure {
 public:
  // Constructor.
  Structure();

  // Check if tetromino is colliding with border or structure.
  bool checkCollision(Tetromino tetromino);

  // Add the tetromino (at its current position) to the structure.
  void addTetromino(Tetromino tetromino);

  // Remove full lines from the structure.
  void removeFullRows();

  // Draw the current structure (in red).
  void show();

 private:
  // The 10 x 20 cells of the structure.
  bool _cells[10][20];
};