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

APT.all-test.Johnbot.Johnbot.ambush.soar Maven / Gradle / Ivy

echo "\nLoading ambush"
## Suggest ambush if there is a hiding place

sp {quake*propose*ambush*hide
   (state  ^name quake
              ^map.explored true
             -^predicting true
             -^self.get-objects-exist true
              ^map.current-room.hiding-place 
              ^self.tactics full)
  -{( ^io.input-link.agent.cycle > 
         ^map.current-room.search.hide-time )}
   -->
   (write (crlf) |Suggest ambush here.|)
   ( ^operator  + =)
   ( ^name ambush
        ^type hide)
   }

sp {quake*select*ambush*random
   (state  ^name quake
              ^io.input-link.agent.random-number > 80
              ^operator  +)
   ( ^name ambush ^type hide)
   -->
   ( ^operator  >)}

## Suggest ambush if in room enemy goes to a lot

sp {quake*propose*ambush*enemy-room
   (state  ^name quake
              ^map.explored true
              ^self.tactics full
             -^self.get-objects-exist true
              ^parameters.enemy-visit-cutoff 
              ^map )
   ( -^room.enemy-visit-count > 
           ^current-room.enemy-visit-count { >   })
  -{( ^io.input-link.agent.cycle > 
         ^map.current-room.search.hide-time )}
   -->
   ( ^operator  + =, >)
   ( ^name ambush
        ^type enemy-room)}

sp {quake*select*ambush-hide
   (state  ^name quake
              ^operator  +
                         +)
   ( ^name ambush ^type hide)
   ( ^name ambush ^type enemy-room)
   -->
   ( ^operator  > )}

## Suggest Ambush if in room I predict enemy will go to.

sp {quake*propose*ambush*predict-final-room
   (state  ^name quake
              ^map.explored true
              ^top-state )
   ( #-^self.get-objects-exist true
          ^enemy.prediction-final-room-number 
          ^map.current-room.room-number )
 # -{( ^io.input-link.agent.cycle > 
 #        ^map.current-room.search.hide-time )}
 # Base prediction hide-time on enemy
   -->
   ( ^operator  + =, >)
   ( ^name ambush
        ^type prediction)}

## Record how long will sit in ambush spot.

sp {quake*apply*ambush*record-hide-time
   (state  ^operator.name ambush
              ^io.input-link.agent 
              ^top-state.parameters.max-hide-time 
              ^map.current-room.search )
   ( ^cycle 
	    ^random-number )
   ( -^hide-time)
   -->
   ( ^hide-time (+  (*  )))
   }