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

APT.all-test.dice-model-bot-new.Impasse_Tie.evaluate-operator.compute-challenge-probability.soar Maven / Gradle / Ivy


sp {evaluate-operator*propose*compute-challenge-probability
   (state  ^name evaluate-operator
              ^top-state.probabilities true
              ^top-state.io.input-link.history.action << bid push >>
              ^superstate.operator )
   ( ^superoperator )
   ( ^name challenge
         ^target )
-->
   ( ^operator  + =)
   ( ^name compute-challenge-probability
         ^target )
}

## If there was an intervening PASS consider challenging previous bid

sp {evaluate-operator*propose*compute-challenge-probability*intervening-pass
   (state  ^name evaluate-operator
              ^top-state.probabilities true
              ^top-state.io.input-link 
              ^superstate.operator )
   ( ^history.action pass
            ^state.last-bid )
   ( ^action << bid push >>
         ^player.name )
   ( ^superoperator )
   ( ^name challenge        # player being challenged is one that made bid
         ^target )
   ( ^name )
-->
   ( ^operator  + =)
   ( ^name compute-challenge-probability
         ^target )
}

## Thinking of challenging a one bid
sp {apply*compute-challenge-probability*1*bid
   (state  ^operator 
              ^superstate.operator.evaluation 
              ^top-state 
              ^dice-counts.dice-count  )
   ( ^name compute-challenge-probability
         ^target )
   ( ^id )
   ( ^io.input-link.state.last-bid 
         ^io.output-link )
   ( ^face 1
          ^count )
   ( ^face unknown
          ^count )
   ( ^action bid
         ^face 1
         ^player.id 
         ^multiplier )
-->
   (write (crlf) |  Challenge: |  | 1's.  Bid: |  |, Known:| )
   ( ^total-known (-  )
        ^total-possible (- (+  ) ))
   ( ^qna-query )
   ( ^qna-query )
   ( ^query compute-probability
         ^source dice
         ^results all
         ^parameters )
   ( ^count (-  )
          ^number-of-dice 
          ^number-of-faces 6
          ^predicate lt)
}

## Thinking of challenging a non-one bid with special rules
sp {apply*compute-challenge-probability*special-rules
   (state  ^operator 
              ^superstate.operator.evaluation 
              ^top-state 
              ^dice-counts.dice-count  )
   ( ^name compute-challenge-probability
         ^target )
   ( ^id )
   ( ^io.input-link.state.last-bid 
         ^io.output-link 
         ^io.input-link.state.special true)
   ( ^face 
          ^count )
   ( ^face unknown
          ^count )
   ( ^action bid
         ^face { <> 1  }
         ^player.id 
         ^multiplier )
-->
   (write (crlf) |  Challenge: |  | |  |'s. Special rules.|)
   ( ^total-known (-  )
        ^total-possible (- (+  ) ))
   ( ^qna-query )
   ( ^qna-query )
   ( ^query compute-probability
         ^source dice
         ^results all
         ^parameters )
   ( ^count (-  )
          ^number-of-dice 
          ^number-of-faces 6
          ^predicate lt)
}

## Thinking of challenging a non-one bid with normal rules
sp {apply*compute-challenge-probability*normal-rules
   (state  ^operator 
              ^superstate.operator.evaluation 
              ^top-state 
              ^dice-counts.dice-count   )
   ( ^name compute-challenge-probability
         ^target )
   ( ^id )
   ( ^io.input-link.state.last-bid 
         ^io.input-link.state.special false
         ^io.output-link )
   ( ^face {<> 1  }
          ^count )
   ( ^face unknown
          ^count )
   ( ^face 1
          ^count )
   ( ^action bid
         ^face { <> 1  }
         ^player.id 
         ^multiplier )
-->
   (write (crlf) |  Challenge: |  | | 
   |'s. Normal rules. Need: | (-   (+   ))
                              |. Out of: |  )
   ( ^total-known (- (+   ) )
        ^total-possible (- (+   ) ))
   ( ^qna-query )
   ( ^qna-query )
   ( ^query compute-probability
         ^results all
         ^source dice
         ^parameters )
   ( ^count (-  (+  ))
          ^number-of-dice 
          ^number-of-faces 3
          ^predicate lt)
}

sp {apply*compute-challenge-probability*use-result
   (state  ^operator 
              ^superstate.operator.evaluation )
   ( ^qna-query )
   ( ^result.features.probability )
   ( ^name << compute-challenge-probability compute-bid-probability compute-exact-probability
                  compute-bid-push-probability >> )
-->
   (write (crlf) |>>>Probability: | )
   ( ^probability )
}