骰子游戏中的Expectiminimax

时间:2015-02-19 10:29:20

标签: algorithm artificial-intelligence dice minimax

我已经为骰子游戏实施了expectiminimax算法,但它肯定无法正常工作,你可以验证我是否正确实现了它?

至于现在,我可以选择随机骰子选择,我的AI的'智能'也会类似,但我不知道我的算法可能出错。

游戏的流程如下(对于那些不了解骰子游戏的人):

  1. 玩家掷骰子
  2. 玩家选择他们想再投掷的骰子
  3. 玩家掷骰子
  4. 我的算法如下,我将其分为4部分

    maxDice = [x,x,x,x,x]
    minDice = [x,x,x,x,x]
    
    Max:
    for combination in each possible combination of maxDice that max can throw again (including none):
     max = max(MaxChance(combination),max)
    
    MaxChance(combination):
    expected = 0
    for actualCombination in each possible result of max dice throw:
     maxHand = maxDice - combination + actualCombination //these are set operations of course
     expected += ProbablityOfThrowing(actualCombination)*Min(maxHand)
    return expected
    
    Min(maxHand):
    for combination in each possible combination of minDice that min can throw again (including none):
     min = min(MinChance(combination,maxHand),min)
    return min
    
    MinChance(minCombination,maxHand):
    expected = 0
    for actualCombination in each possible result of min dice throw:
     minHand = minDice-minCombination+actualCombination
     expected += ProbablityOfThrowing(actualCombination)*Evaluate(maxHand,minHand)
    return expected
    
    //for example
    Evaluate(maxHand,minHand):
    return ValueOfDiceHand(maxHand)-ValueOfDiceHand(minHand)
    

0 个答案:

没有答案