basic behaviors
 
 
 if (state[2] == NEAR || state[3] == NEAR || state[4] == NEAR)
    speed = -1.0;  // Go backwards if we’re running into something
  else if (state[6] == FAR)
    speed = 2.5;  // Slow down a lot if we’re past the end of the wall
  else if (state[5] == FAR)
    speed = 5.0;  // Slow down a little if the wall end is coming
    speed = nominalSpeed;  // 7.0