 
 // if the potentiometer is between pot_locs[2*i] and pod_locs[2*i+1], then we 
 // say we are in position i.  otherwise, we are between positions.
-int pot_locs[14] = {1024, 885, 825, 690, 640, 450, 390, 280, 190, 70, 50, 24, 12, 0};
+// TODO(benkraft): Consider narrowing these.
+int pot_locs[14] = {1024, 885,
+                    825, 690,
+                    640, 450,
+                    390, 280,
+                    190, 70,
+                    50, 24,
+                    12, 0};
 
 // above this = white; below = black (unlodged is undefined)
 // TODO(benkraft): Recompute after we move them.

// Caller likely wants to reset internal state here.
void sendCastleErrorMessage()
{
  // TODO(benkraft): May or may not need to wait a tick to be sure here.
  // TODO(benkraft): May want to log debugging info here.
  Serial.println(21);
}

void printState()
{
  // print out position of the pot
  Serial.print("pot: ");
  Serial.println(getSelectorGearPosition());
  // print out the three photoresistors.
  Serial.print("photoresistors:");
  for (int i=0; i<3; i++)
  {
    Serial.print(" ");
    Serial.print(getRawPhotoresistor(i));
    Serial.print(" (");
    Serial.print(analogRead(photoresistors[i]));
    Serial.print(")");
  }
  Serial.println("");
  
  Serial.print("state: ");
  Serial.println(state);
  Serial.print("last selector pos: ");
  Serial.println(last_selector_pos);

  // history gets printed when we finish it

  if (state == 2)
  {
    for (int i=0; i<3; i++)
    {
      Serial.print("gear ");
      Serial.print(i);
      Serial.print("type: ");
      Serial.print(gear_types[i]);
      Serial.print(", orientation: ");
      Serial.print(gear_orientations[i]);
      Serial.println("");
    }
  }
  
  Serial.println("");
}


void printGearRead(int i, boolean failed)
{
  if (debug_state > 0)
  {
    Serial.print("GEAR ");
    Serial.print(i);

        if (winning)
        {
          state = 3;
          winning_blink_state = 0;
          sendCastleSuccessMessage();
        }
      }
    }
  }

  if (state == 3)
  {
    if (buttonPressed())
    {
      state = 0;
      winning_blink_state = -1;
      resetLights();
    }
    else
    {
      blinkWinningLights();
    }
  }

  last_selector_pos = selector_pos;
