All Downloads are FREE. Search and download functionalities are using the official Maven repository.

APT.all-test.MOUTBot.execute-mission.defend.predict-enemy.soar Maven / Gradle / Ivy

echo "\nLoading defend/predict-enemy"

#%%%%%%%%%%%%%%% TESTING ONLY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#This rule creates a fake enemy to test the predict-enemy code
#
#sp {defend*elaborate*state*shadow-enemy
#   (state  ^name defend
#              ^top-state )
#   ( ^map.area )
#   ( ^name |Outside|)
#-->
#   ( ^threats.threat )
#   ( ^angle-off  
#        ^area  
#        ^area-name |Outside| 
#        ^aspect  
#        ^health 100 
#        ^name |Shadow| 
#        ^position 
#        ^team |None| 
#        ^weapon AKMSU)
#   ( ^h 356
#         ^v 10)
#   ( ^h 345
#             ^v 0)
#   ( ^x 992.149
#          ^y -578.983
#          ^z -925.335)
#}
#
#%%%%%%%%%%%%%%% END OF TESTING ONLY SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


#IF:
#1.  I have very recently seen an enemy
#2.  But he is no longer visible
#THEN:
#  Propose: Attempt to predict the enemy's actions
#JEL 8/20/02 - Commented out because it doesn't work with new initialize
#sp {defend*propose*predict-enemy
#   (state  ^name defend
#              ^top-state 
#              ^io.input-link.objects )
#   ( ^threats.threat )
#   (  -^prediction-final-area)
#-->
#   ( ^operator  +, = 50)
#   ( ^name predict-enemy
#        ^entity )
#}

#predict-enemy only when other defend ops aren't available
sp {defend*compare*predict-enemy*worse-than-other-active-ops
   (state  ^name defend
              ^operator  +
                         +)
   ( ^name { <> predict-enemy <> maintain-position })
   ( ^name predict-enemy)
-->
   ( ^operator  > )
}

#predict-enemy is better than maintain-position
sp {defend*compare*predict-enemy*better-than-maintain-position
   (state  ^name defend
              ^operator  +
                         +)
   ( ^name predict-enemy)
   ( ^name maintain-position)
-->
   ( ^operator  > )
}

#Initialize enemy's ^old-area to the current room.  
#This is used to keep track of where the enemy 
#has come from as the bot simulates his movements.
sp {apply*predict-enemy*record-enemy-room
   (state  ^operator )
   ( ^name predict-enemy
        ^entity )
   ( -^old-area 
         ^area )
-->
   ( ^old-area )
   (interrupt)
}