(defrule move-by-default
	?hecho <- (TurnRemaining ?x)
	(NewTurn)
	(not (OnTheMove))
	=>
	(retract ?hecho)
	(store Back 1000)
	(store TurnGunRight 270)
	(store MaxVelocity 20)
	(assert (NowTurningGun Right))
	(assert (NowMoving Back)))

(defrule choque-con-pared
    	?hecho1 <- (HitWallEvent)
    	?hecho2 <- (NowMoving Back)
    	=>
    	(store Back 10000)
	(store TurnRight 5)
    	(retract ?hecho1)
    	(retract ?hecho2)
	(assert (NowTurning Right))	
   	(assert (NowMoving Back)))

(defrule choque-con-robot-delante
	?hecho1 <- (HitRobotEvent)
	?hecho2 <- (NowMoving Ahead)
	=>
	(retract ?hecho1)
	(retract ?hecho2)
	(store Back 10)
	(store TurnGunRight 90)
	(store MaxVelocity 10)
	(assert (NowTurningGun Right))
	(assert (NowMoving Back)))

(defrule choque-con-robot-atras
	?hecho1 <- (HitRobotEvent)
	?hecho2 <- (NowMoving Back)
	=>
	(retract ?hecho1)
	(retract ?hecho2)
	(store Ahead 10)
	(store TurnGunRight 90)
	(store MaxVelocity 10)
	(assert (NowTurningGun Right))
	(assert (NowMoving Ahead)))

(defrule dispara
	(ScannedRobotEvent)
	=>
	(store Fire 1))

(defrule dispara2
	?hecho1<-(HitRobotEvent)
        ?me<-(< -10 Bearing)
	?h<-(< Bearing 10)
	?hecho2<-(&& ?me ?h)
	=>
	(retract ?hecho1)
	(retract ?hecho2)
	(store Fire 3))
	