(defrule move-by-default
	?f <- (TurnRemaining ?x)
	(NewTurn)
	(not (OnTheMove))
    =>
   	(retract ?f)
	(store TurnGunRight 360)
    	(assert (NowTurningGun Right)))

(defrule dispara-si-ves-a-alguien
    	?e<-(ScannedRobotEvent)
	?f<-(NowTurningGun Right)
    =>
	(retract ?e)
	(retract ?f)
    	(store Fire 1))

(defrule disparado-por-alguien
	?event<-(HitByBulletEvent)
	=>
	(retract ?event)
	(store Ahead 100)
	(assert (NowMoving Ahead)))


(defrule escanea
	?fact <- (or (NowMoving Ahead) (NowMoving Back))
	?cond <- (TurnRemaining ?x&:(= ?x 0))
	=>
	(retract ?fact)
	(retract ?cond)
	(store TurnGunRight 360)
    	(assert (NowTurningGun Right)))

(defrule atras-por-choque-con-pared
    ?event <- (HitWallEvent)
    ?fact <- (NowMoving Ahead)
    =>
    (store Back 300)
    (retract ?event)
    (retract ?fact)
    (assert (NowMoving Back)))

(defrule adelante-por-choque-con-pared
    ?event <- (HitWallEvent)
    ?fact <- (NowMoving Back)
    =>
    (store Ahead 100)
    (retract ?event)
    (retract ?fact)
    (assert (NowMoving Ahead)))



