【问题标题】:Following a Dynamic Score遵循动态分数
【发布时间】:2011-03-08 03:25:02
【问题描述】:

我几乎没有接受过正式的离散数学培训,并且遇到了一点问题。我正在尝试编写一个代理,它读取人类玩家的(任意)分数并经常得分。智能体需要时不时地“落后”和“追赶”,这样人类玩家才会相信存在一些竞争。然后,智能体必须赢或输(取决于条件)与人类。

我尝试了一些不同的技术,包括一个不稳定的概率循环(失败得很惨)。我在想这个问题需要像发射隐马尔可夫模型(HMM)这样的东西,但我不确定如何实现它(甚至这是否是最好的方法)。

我有一个gist,但同样糟糕。

我希望__main__ 函数能够提供一些关于此代理目标的见解。它将在 pygame 中调用。

【问题讨论】:

  • 更多细节可能会有所帮助 - 这是什么类型的“游戏”?得分是像弹球游戏那样频繁,还是像足球那样不经常得分(除非你是巴西人)?
  • 游戏是俄罗斯方块。我写它是为了让玩家每下一个区块获得 10 分,当玩家得分一些线时,他们获得线 ** 2 * 100 。
  • 只是好奇,为什么不把它变成一场真正的比赛,让代理实际玩游戏并获得分数?
  • 这是一个心理学实验;需要有赢的条件和输的条件。

标签: python statistics artificial-intelligence agent


【解决方案1】:

我想你可能想多了。您可以使用简单的概率来估计计算机的分数应该“赶上”的频率和程度。此外,您可以计算计算机得分与人类得分之间的差异,然后将其输入到类似 sigmoid 的函数中,以得出计算机得分增加的程度。

说明性 Python:

#!/usr/bin/python
import random, math
human_score = 0
computer_score = 0
trials = 100
computer_ahead_factor = 5 # maximum amount of points the computer can be ahead by
computer_catchup_prob = 0.33 # probability of computer catching up
computer_ahead_prob = 0.5 # probability of computer being ahead of human
computer_advantage_count = 0
for i in xrange(trials):
    # Simulate player score increase.
    human_score += random.randint(0,5) # add an arbitrary random amount
    # Simulate computer lagging behind human, by calculating the probability of
    # computer jumping ahead based on proximity to the human's score.
    score_diff = human_score - computer_score
    p = (math.atan(score_diff)/(math.pi/2.) + 1)/2.
    if random.random() < computer_ahead_prob:
        computer_score = human_score + random.randint(0,computer_ahead_factor)
    elif random.random() < computer_catchup_prob:
        computer_score += int(abs(score_diff)*p)
    # Display scores.
    print 'Human score:',human_score
    print 'Computer score:',computer_score
    computer_advantage_count += computer_score > human_score
print 'Effective computer advantage ratio: %.6f' % (computer_advantage_count/float(trials),)

【讨论】:

    【解决方案2】:

    我假设人类看不到计算机代理在玩游戏。如果是这种情况,您可以尝试以下一种方法。

    创建可以为任何给定移动计分的所有可能点组合的列表。对于每一步,找到一个你希望代理在当前回合后结束的分数范围。将一组可能的移动值减少到仅将代理结束在该特定范围内的值并随机选择一个。随着您希望代理落后或领先多远的条件发生变化,只需适当地滑动您的范围即可。

    如果您正在寻找具有某种内置和经过研究的人类心理影响的东西,我无法帮助您。如果您想要比这更具体的内容,您将需要为我们定义更多规则。

    【讨论】:

    • 我喜欢这个。我会在星期六尝试实现它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多