- self turn-left with-velocity(20).\r
- self set-global-velocity to (15).\r
- if valuef >7: \r
- self set-global-velocity to (15).\r
- else if (valuef <=7) && (valuef > 0):\r
- { \r
- self set-global-velocity to (0).\r
- #self turn-left with-velocity(2).\r
- #self turn-right with-velocity(2).\r
- #self set-global-velocity to (0).\r
- }\r
- #print "sensor valuef: $valuef valueb: $valueb".\r
- \r
- #else if value < 0.1: self turn-left with-velocity CELDAS_MAX_TURN_VELOCITY.\r
- #else if value > 10: self set-global-velocity to ((self get-global-velocity) - 1).\r
+ if(avanzando):\r
+ if(valuef>15):\r
+ self set-global-velocity to (15).\r
+ else \r
+ { \r
+ avanzando=0.\r
+ retrocediendo=1.\r
+ } \r
+\r
+\r
+ if(retrocediendo):\r
+ if(valueb>15):\r
+ self set-global-velocity to (-15).\r
+ else \r
+ { \r
+ tleft=1.\r
+ retrocediendo=0.\r
+ }\r
+\r
+\r
+ if((tleft) && (valuel>10)): \r
+ {\r
+ #self set-global-velocity to (0).\r
+ self turn-left.\r
+ }\r
+ else\r
+ {\r
+ avanzando=1.\r
+ #tright=1.\r
+ }\r