 const Color colors[MAXIMUM_NUMBER_OF_PLAYERS] = {color_red, color_green, color_yellow, color_violet, 
                                                  color_orange, color_darkgreen, color_darkgoldenrod, color_white};
 
+class Effect
+{
+private:
+  const Color colors[EFFECT_COLORS] = {color_black, color_black, color_black, color_black, color_black};
+  int x;
+  int y;
+  uint8_t color_index;
+  bool activated; 
+public:
+  Effect()
+  {
+    activated = false;
+    color_index = 0;
+  }
+
+  void activate()
+  {
+    for (int i = 10; i; i--)
+    {
+      x = random(ledtable.minX(), ledtable.maxX() + 1);
+      y = random(ledtable.minY(), ledtable.maxY() + 1);
+      activated = ledtable.at(x, y) == BACKGROUND_COLOR;
+      if (activated)
+      {
+        break;
+      }
+    }
+  }
+
+  void update()
+  {
+    if (activated)
+    {
+      paint();
+      collide();
+    }
+  }
+
+  void paint()
+  {
+    color_index = (color_index + 1) % EFFECT_COLORS;
+    ledtable.fill(x, y, colors[color_index]);
+  }
+
+  void collide()
+  {
+    
+  }
+};
+
+
 enum PlaterState {MOVING, EXPLODING, END_OF_EXPLOSION, DEAD};
 enum PlayerDirection {DOWN = 0, LEFT = 1, UP = 2, RIGHT = 3, STANDING};
+enum ButtonState {CATCHING_INPUT, WAITING_FOR_PLAYER_TO_SWITCH_BACK};
 
 class Player
 {

  const int rightPin()
  {
    return playerPins[index][1];
  }

  void setup()

  }
}

void catchInput()
{
  for (int i = 0; i < NUMBER_OF_PLAYERS; i++)
  {
    players[i].catchInput();
  }
}

int frame;

void setup()
{
  frame = 0;
  ledtable.begin();
  ledtable.fill(BACKGROUND_COLOR);
  //ledtable.brightness(50);
  setupPlayers();
}

void wait()
{
  int now = millis();
  int stop = millis() + TIME_BETWEEN_ROUNDS_MILLIS;
  int offset;
  if (stop < now) 
  {
    offset = - 2 * TIME_BETWEEN_ROUNDS_MILLIS;
    now -= offset;
    stop -= offset;
  } else  {
    offset = 0;
  }
  for (int i = millis(); i + offset < stop; i = millis())
  {
    catchInput();
  }
}

void loop()
{
  updatePlayers();
  ledtable.show();
  wait();
  frame++;
}













