  * ===========================
  */
 
+// Check if there are lines that are to clear, if there are: clear them and show the new score
  void clearLines() {
 
   boolean lLineClear = true;

  mNextBlock = random(7);
  showBlock();
  blockCounter++;
  if (fieldmap[mPosX][mPosY] != -1) {
    gameOver = true;
  }
}
/* 
 * ===========================================
 *  SNES-Controller Commands

void setup()
{
  Serial.begin(9600);

  // Checking if Controller is avaible, if not tetris won't continue but stop.
  if (controller.read() != false) {
    Serial.println("SNES Controller avaible");
    gameOver = true;
  } else {
    Serial.println("SNED Controller unavaible");
  }

  // Initialization of the Fieldmap to -1 (no pixel unavaible).
  initFieldmap();

  // Generate a random Seed from a fluctuating port
  randomSeed(analogRead(0));

  // Activate the LEDTable and set its brightness as well as coloring the game board.
  ledtable.begin();
  ledtable.brightness(40);
  for (int i = 0; i < sizeY; i++) {
    for (int j = 0; j < sizeX; j++) {
      ledtable.fill(j,i,RGB(0,0,64));
    }
  }
  ledtable.show();

  // Get the first random number since it is always 0, forget it and then set the Block and the next block.
  random(7);
  mThisBlock = random(7);
  mNextBlock = random(7);

  // Show the block used at the moment
  showBlock();
}

// Main Loop for the Arduino
void loop()
{
  // Get the controller state
  word state = controller.read();

  // Check again if Controller is connected, otherwise do nothing, then check if the game isn't paused or over
  if (state != false) {
    if (!gameOver && !pause) {
      if (bitRead(state, 4) == false)
      {
        rotate();
        delay(125);
      }
      if (bitRead(state, 5) == false)
      {
        fall();
        delay(20);
      }
      if (bitRead(state, 6) == false)
      {
        left();
        delay(75);
      }
      if (bitRead(state, 7) == false)
      {
        right();
        delay(75);
      }
      if (bitRead(state, 8) == false) {
        down();
        delay(75);
      }
    }
    if (bitRead(state, 2) == false && !gameOver) {
      pause = !pause;
      delay(100);
    }
    if (bitRead(state, 3) == false) {
      reset();
      delay(75);
    }
  }
  counter++;

  // Initiate fall sequence if the limit of frames is reached.
  if (counter >= limit && !gameOver && !pause) {
    fall();
    counter = 0;
  }

  // After a number of blocks manifested (cycles) reduce the limit.
  if (cycles > maxCycles) {
    if (limit > difficulty) {
      limit -= difficultyHardening;
    }
    cycles = 0;
  }
