#include "GameLoop.h"

void setup()
{
  // Set random seed
  randomSeed(analogRead(A0));

  // Serup pins
  pinMode(LED_PIN_1, OUTPUT);
  pinMode(LED_PIN_2, OUTPUT);
  pinMode(LED_PIN_3, OUTPUT);
  pinMode(LED_PIN_4, OUTPUT);
  pinMode(LED_PIN_5, OUTPUT);
  pinMode(BUTTON_PIN, INPUT);
  pinMode(BUZZER_PIN, OUTPUT);

  // Initialize the gamestate
  currentGameState = IDLE;

  // Setup for the button handler
  ButtonHandlerSetup();
}

void loop()
{
  // Handle button presses and set the buttonActiveThisCycle variable
  ButtonHandler();

  // Excute the correct state based on the currentGameState
  switch (currentGameState)
  {
    case IDLE:
      IdleState();
      break;
    case PLAYING:
      PlayingState();
      break;
    case LISTENING:
      ListeningState();
      break;
  }

  // Reset the buttonActiveThisCycle variable so it is only true for one cycle
  buttonActiveThisCycle = false;
}

