 
 void catchInput()
 {
-  for (int i = 0; i < NUMBER_OF_PLAYERS; i++)
+  FOR_PLAYERS(i)
   {
     players[i].catchInput();
   }
 }
 
-int frame;
+
+void letOtherPlayersCollide(int index)
+{
+  bool collided = false;
+  for (int i = index + 1; i < NUMBER_OF_PLAYERS; i++)
+  {
+    if (players[i].collidesWith(&players[index]) && players[index].collidesWith(&players[i]))
+    {
+      players[i].collided();
+      collided = true;
+    }
+  }
+  if (collided)
+  {
+    players[index].collided();
+  }
+}
+
+/********************** Powerups ************************/
+
+int time_between_frames;
+
+void speedup()
+{
+  if (time_between_frames == TIME_BETWEEN_ROUNDS_MILLIS_SLOWDOWN)
+  {
+    time_between_frames = TIME_BETWEEN_ROUNDS_MILLIS;
+  } else {
+    time_between_frames = TIME_BETWEEN_ROUNDS_MILLIS_SPEEDUP;
+  }
+}
+
+void slowdown()
+{
+  if (time_between_frames == TIME_BETWEEN_ROUNDS_MILLIS_SPEEDUP)
+  {
+    time_between_frames = TIME_BETWEEN_ROUNDS_MILLIS;
+  } else {
+    time_between_frames = TIME_BETWEEN_ROUNDS_MILLIS_SLOWDOWN;
+  }
+}
+
+
+#define POWERUP_COLORS 3
+
+Color powerup_colors[POWERUP_COLORS] = { SPEEDUP_COLOR, INVULNERABLE_COLOR, SLOWDOWN_COLOR };
+
+void spawnPowerup()
+{
+  if (random(0, EXPECTED_TIME_BETWEEN_POWERUPS) == 0)
+  {
+      int x = random(ledtable.minX(), ledtable.maxX() + 1);
+      int y = random(ledtable.minY(), ledtable.maxY() + 1);
+      if (ledtable.at(x, y) == BACKGROUND_COLOR)
+      {
+        int choice = random(0, POWERUP_COLORS);
+        ledtable.fill(x, y, powerup_colors[choice]);
+      }
+  }
+}
 
 void setup()
 {
-  frame = 0;
+  // randomness
+  uint8_t v = EEPROM.read(0);
+  for (int i = 0; i < v; i++)
+  {
+    random(256);
+  }
+  EEPROM.write(0, random(256));
+  frame = 1;
+  time_between_frames = TIME_BETWEEN_ROUNDS_MILLIS;
+  Serial.begin(9600);
   ledtable.begin();
   ledtable.fill(BACKGROUND_COLOR);
   //ledtable.brightness(50);

#include <ledtable.h>

/* These constants can change the game */
#define NUMBER_OF_PLAYERS 4
#define STEPS_TO_HOLE 5
#define BACKGROUND_COLOR color_black
#define TIME_BETWEEN_ROUNDS_MILLIS 300

/* These are private constants */
#define MAXIMUM_NUMBER_OF_PLAYERS 8

    state = END_OF_EXPLOSION;
  }

  void collideWithObstaclesAndPowerups() 
  {
    if (ledtable.isOutside(x, y))
    {
      collided();
      return;
    }
    Color collided_color = ledtable.at(x, y);
    switch (collided_color)
    {
      case BACKGROUND_COLOR: break;
      case INVULNERABLE_COLOR: becomeInvulnerable(); break;
      case SPEEDUP_COLOR: speedup(); steppedOnPowerup(); break;
      case SLOWDOWN_COLOR: slowdown(); steppedOnPowerup(); break;
      default: collided();
    }
  }

  void collided()
  {
    state = EXPLODING;
  }

  void react()
