         // Display the pattern.
         for (int lvl = 0; lvl < currentLevel; lvl++) {
 
-            // Blink the LED.
+            // Blink the current pattern LED.
             digitalWrite(pattern[lvl], HIGH);
             delay(GAME_SPEED);
             digitalWrite(pattern[lvl], LOW);

boolean signalGameStart() {

    // Check the tilt switch and buttons for a new game.
    if (digitalRead(TILT) || analogRead(BUTTONS) > 3) {
        gameStart = true;
    }

    // Flash all LEDs to signal game start if appropriate.
    if (gameStart) {

        // Blink lights twice.
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < QTY; k++) {
                digitalWrite(LEDS[k], HIGH);

    // The game has not begun.
    return false;
}


/**
 * Determine whether the player successfully matched the pattern.
 */
boolean verifyPlayerInput(int *pattern, int currentLevel) {

    // Get player input up through the current game level.
    int lvl = 0;
    while (lvl < currentLevel) {

        // Wait for a button press.
        int simonLed = -1;
        while (simonLed == -1) {
            simonLed = getSimonLed(analogRead(BUTTONS));
        }

        // Blink the corresponding LED.
        digitalWrite(simonLed, HIGH);
        delay(GAME_SPEED);
        digitalWrite(simonLed, LOW);

        // Check if the button press was correct.
        if (pattern[lvl] == simonLed) lvl++;
        else return false;
    }

    // The player successfully matched the pattern.
    return true;
}
