所以,现在流行的囚徒困境变体是囚徒的三重引理,其中有三种选择。我可以很容易地看到它在增加,所以我想
当我们可以拥有无限选项时,为什么要选择三个选项呢?
因此,我创造了浮点囚徒的引理。
每一轮,你的分数将被计算为(a是玩家1返回的,b是玩家2返回的):
\text{Player 1 expected score: }\quad 2ab+3(1-a)b+(1-a)(1-b)
\text{Player 2 expected score: }\quad 2ab+3a(1-b)+(1-a)(1-b)
3是诱惑性的回报,如果a缺陷与b合作,D12就能得到回报。2是一种奖励,因为如果双方合作的话。1是一种惩罚,因为如果两者都有缺陷。吸盘的回报是0,这就是a在a合作和b缺陷时得到的回报。
中浮点数含义的解释
基本上,0.5的输出意味着合作的具象概率(控制器几乎是确定性的,仅随机匹配参赛者)为0.5。这意味着,由于输出接近于1,而不是0,对手得到了一些分数,但不像我们关注的选手的输出是1。
它使用来自https://math.stackexchange.com的优秀研究员的一个方程来决定该做什么,浮点数与coop或缺陷的概率相关。然而,控制器在得分方面是确定性的,并且不把概率作为概率来处理。方程在控制器的play函数中。
注意:运行时,它有时会打印类似于[,,]之类的内容。这只是我忘了删除的一个旧的调试特性。
创建一个机器人,它可以播放这个Python实现的囚徒?引理。创建两个函数,strategy和plan,它们的格式类似于下面的示例。每次比赛结束后,可以通过在控制器中注释掉运行中的行来更改这个选项
self.store = {
}这是一个基本的bot模板:
def strategy(is_new_game, store):
# Put Stuff Here™. is_new_game tells the function if it's a new game. returns a value between 0 and 1, where 1 = coop and 0 = defect, and in-between stuff correlates to probability of coop or defect. Store is a dict for storage.
def plan(opmove, store):
# opmove is the opponents move last round. This function shouldn't return anything. Put pass here if you don't use this.♫Coop Bop Bot♫
#Example Contestant
def strategy(is_new_game):
return 1
def plan(opmove):
pass随机性
#Example Contestant
import random
def strategy(is_new_game):
return random.random()
def plan(opmove):
pass控制器在https://github.com/4D4850/KotH-Floating-Dilemma
请随意提出拉请求。
Random, 165500.78318694307
Helped, 147835.72861717656
Cooperator, 125285.07526747975
Random Alternator, 82809.27322624522
Tit for Tat, 51139.558474789665如果你没看到你的机器人,就会出错。
注意:“帮助”和“随机交流发电机”需要稍加修改才能正常运行。另外,在得分系统中有一个灾难性的错误,现在已经修复了。
发布于 2021-06-18 08:02:56
def strategy(is_new_game, store):
if store and store['moves']:
return store['moves'][-1]
return .1
def plan(opmove, store):
if opmove > .5:
if store and store['moves']:
store['moves'].append(opmove / 2)
else:
store['moves'] = [opmove / 2]
else:
if store and store['moves']:
store['moves'].append(opmove * 2)
else:
store['moves'] = [opmove * 2]Helped是一个机器人,它取决于对手之前的动作。选择较高的下一个较低的移动,而较低的为较高的移动。
发布于 2021-06-18 11:07:24
store[0] = 0
store[1] = 0
print(store)
import random
def strategy(is_new_game, store):
if is_new_game or store[0]%100 < 10:
store[1] += 1
return random.random()
else:
store.append(store[1] + 1, (sum(store)/len(store)))
store[1] += 1
return sum(list(store)[1:])/len(list(store)[1:])
def plan(opmove, store):
store.append(store[1] + 1, opmove)
store[1] += 1
store[0] += random.random() + random.random()
return store随机交替取移动的总平均值和随机移动的随机方式(希望,不可利用)。
发布于 2021-06-19 05:37:52
def strategy(is_new_game, store):
if is_new_game: return 1
return store[0]
def plan(opmove, store):
store[0]=opmovehttps://codegolf.stackexchange.com/questions/229926
复制相似问题