 */
   }
 
-  if(random(1001) <= prob<<1 || pt->angle >= pt->maxAngle || pt->angle <= pt->minAngle){
-    pt->dir *= -1;/*
+  if(random(1001) <= prob << 1 || (pt->angle >= pt->maxAngle && pt->dir == 1) || pt->angle <= pt->minAngle && pt->dir == -1){
+    pt->dir *= -1;
     Serial.println(F("##############CHANGE#################"));
     Serial.println(pt->dir);
-    */
+
   }
 
   return pt->dir;


int getMarkovSpeed(int oldSpeed){
int val = random(101);
if(oldSpeed == 1){
  if(val < 20){
    return 2;

  }
}
else{

  return constrain(oldSpeed, 1, 3);
}

