 
 
 /**
- * Cycles LEDs on and off in a decorative pattern while waiting for player input.
+ * Cycles LEDs on and off in a decorative pattern while waiting for game start.
  */
 void playLightShow() {
 

 */
void loop() {

    // Check if a button switch was pressed.
    int simonLed = getSimonLed(analogRead(BUTTONS));
    if (DEBUG) {

        digitalWrite(LEDS[i], HIGH);
        digitalWrite(LEDS[last], HIGH);

        // Check the tilt switch for a new game.
        if (signalGameStart()) return;

        // Wait before cycling the next set of lights.
        delay(LIGHT_DELAY);
    }

    // Turn off final LED pair.
    digitalWrite(LEDS[0], LOW);
    digitalWrite(LEDS[QTY-1], LOW);
}


/**
 * Checks the switches and determines if the game should start.
 */
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);
            }
            delay(LIGHT_DELAY);
            for (int k = 0; k < QTY; k++) {
                digitalWrite(LEDS[k], LOW);
            }
            delay(LIGHT_DELAY * 2);
        }

        // Signal game start.
        return true;
    }

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