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

APT.all-test.HauntBot.elaborations.choice-sets.soar Maven / Gradle / Ivy

echo "\nLoading elaborations/choice-sets"
                
### This defines the choice sets.

## Each choice set should be a set of mutually exclusive operators where 
##   The bot usually chooses between them at random (or using other heuristics)
##   Below is an example of a single choice set for selecting between
##     attack, surrender, and runaway.  
##   The choice number is used to determine how likely it is for that operator
##     to be selected.  The likelihood will be the range from the next lower choice
##     number to that number.  If a given operator is never to be selected (for testing)
##     it should be 0. If an operator is to be always selected, it should be 1 and all others
##     0. If two are to be selected from randomly, then one should be .5 and the other 1.0
##   The choice of what the selection will be at run time is made during initialization.
##     Thus, after something is added to the selection set, it will be made best whenever it 
##     is proposed (independent of even other choices not listed). This won't always work
##     if there are betters being used so we need to check on that.


### Example choice set. There would be a choice set for every set of choices.
sp {haunt*state*state*choice-sets
   (state  ^name haunt)
   -->
   ( ^choice-set )
   ( ^choice   
          ^state-name execute-script
          ^random-index 10)  # will pull out the second digit .#x###
   ( ^operator-name surrender
          ^choice-number .33)
   ( ^operator-name attack
          ^choice-number .66)
   ( ^operator-name runaway 
          ^choice-number 1.0)
}


# RUN TIME SELECTION
## Reject not-selected choices if selected choice is proposed.
## By doing it this way, we allow the preferences for operators that aren't include
##  to work as they would anyway - we don't prefer the selected-choice to 
##  other operators that aren't mentioned.

# [1] REW: 2002-07-25
#     JEL sez: I found a bug in my code for the choice stuff.  Please replace these rules
#     in elaborations/choice-sets.soar - they appear near the end of the file.

sp {haunt*select*choice-operator*no-type
   (state  ^operator  +
              ^operator  +
              ^name 
              ^top-state.selection-set )
   ( ^name )
   ( ^name )
   ( ^state-name 
         ^selected-choice 
         ^not-selected-choice )
   ( ^operator-name 
        -^operator-type)
   ( ^operator-name )
   -->
   ( ^operator  -)}

## This is so can choose between different versions (types?) of the same operator

sp {haunt*select*choice-operator*type
   (state  ^operator  +
              ^operator  +
              ^name 
              ^top-state.selection-set )
   ( ^name 
         ^type )
   ( ^name 
         ^type )
   ( ^state-name 
         ^selected-choice 
         ^not-selected-choice )
   ( ^operator-name 
         ^operator-type )
   ( ^operator-name 
         ^operator-type )
   -->
   ( ^operator  -)}