这个挑战的想法很简单:创建一个机器人来玩纸牌游戏Euchre。
对于那些还不了解它们的人,我在这里向Euchre列出了规则,因为它们与这项挑战有关。
我建议使用python或类似的东西,但唯一真正的限制是它必须与控制器代码兼容
输入:
根据游戏或回合的当前阶段,您的euchre机器人将获得不同种类的输入。一般而言,您将在第一行进入游戏阶段,然后是逗号和团队所拥有的积分数量,然后在接下来的几行获得相关数据。
按时间顺序,您的漫游器将按以下顺序获取输入:
Ordering Trump:
js,ah,qc,ts,jc // the cards in your hand
2 // number of points your team has
0 // number of tricks your team has taken
ordering // the phase of the game
th // the turned up card
p,p // each previous player’s decision
Naming Trump:
js,ah,qc,ts,jc // the cards in your hand
2 // number of points your team has
0 // number of tricks your team has taken
naming // the phase of the game
p // each previous player’s decision
Dealer Discarding:
js,ah,qc,ts,jc // the cards in your hand
2 // number of points your team has
0 // number of tricks your team has taken
discard // the phase of the game
th // the card you will pick up
Going alone:
js,ah,qc,ts,jc // the cards in your hand
2 // number of points your team has
0 // number of tricks your team has taken
alone // the phase of the game
h // the trump suit
n,n // each previous player’s decision
Your turn:
js,ah,qc,ts,jc // the cards in your hand
2 // number of points your team has
0 // number of tricks your team has taken
turn // the phase of the game
h // the trump suit
td,8h,p // each previous player’s card
Trick data:
// the cards in your hand (none, since this happens at the end of a trick)
2 // number of points your team has
1 // number of tricks your team has taken
trick // the phase of the game
0 // the index of the following list that is your card
js,tc,4d,js // the cards played during the trick in the order they were played
输出:
根据游戏或回合的当前阶段,您的euchre机器人将具有不同的输出。
Ordering Trump:
p //for pass
OR
o //for order up
Naming Trump:
p //for pass
OR ANY OF
c,s,h,d //the suit you want to name
Going alone:
n // no
OR
y // yes
Your turn:
js //the card you want to play
得分:
您的机器人得分是它赢得的游戏总数。
您的机器人将与其他所有机器人对战,并且将始终与其自身副本配合使用。
笔记:
这是python2.7中的一个简单模板:
#!/usr/bin/python2.7
import sys
data = sys.stdin.readlines()
hand = data[0].strip().split(',') # Hand as a list of strings
points = int(data[1]) # Number of points
tricks = int(data[2]) # Number of tricks
out = ''
if data[3] == 'ordering':
card = data[4] # The upturn card
prev = data[5].strip().split(',') # The previous player's decisions as a list
# Ordering logic
out = # 'o' or 'p'
elif data[3] == 'naming':
prev = data[4].strip().split(',') # The previous player's decisions as a list
# Naming logic
out = # 'p', 'h', 's', 'c', or 'd'
elif data[3] == 'discard':
card = data[4] # The card you'll take
# Discarding logic
out = # The card you want to discard
elif data[3] == 'alone':
trump = data[4] # The trump suit
prev = data[5].strip().split(',') # The previous player's decisions as a list
# Alone logic
out = # 'y' for yes, 'n' for no
elif data[3] == 'turn':
trump = data[4] # The trump suit
prev = data[5].strip().split(',')
# Turn logic
out = # The card you want to play
elif data[3] == 'trick':
trump = data[5]
cards = data[6].strip().split(',')
my_card = cards[int(data[4])]
# Data logic
print(out)
总共有4个回应。如果某人一个人去,那么对方的回应将变成“ p”。
我试图减少冗余输入的数量,因此要特别清楚:
2a。您相对于发牌人/领导者的位置以及您的伴侣所玩的纸牌都可以由先前输出的数量来确定。您和您的伴侣之间只有1个玩家。举例来说,如果您在回合的最后一行获得“ td,8h,p”,您可以看到您的伴侣玩了8h,而另一支球队有一个单独的玩家。
如果您感到好奇,可以以传统方式完成交易(分两轮,每轮交替发送2张和3张卡),但这与您的机器人无关,所以...
如果第二名选手决定在王牌阶段进行加码,则该阶段将继续进行,但他们的输出将几乎被忽略。换句话说,无论其他什么输出,谁先预定谁就是Namers团队。
以下是各个游戏阶段的默认设置。如果您没有为该回合输出有效的答复,那么您的答复将更改为以下内容。
订购特朗普:p
命名特朗普:p
丢弃:(您手中的第一张卡片)
独自行动:n
轮到您了:(您手中的第一张合法卡)
这是用于测试目的的控制器代码。
6a。请注意,您可以传入2个或4个漫游器名称,如果给它4个漫游器,则它们会随机配对,而与2个漫游器则是它们自己的副本配对。
6b。您需要与控制器代码位于同一目录中的“ bots”目录,并且您的bot代码必须位于bots目录中。
对于那些希望他们的机器人记住曾玩过哪些牌的人,在“技巧”阶段会给您机会,告诉您的机器人玩了哪些牌。您可以写入bots目录中的文件,只要该文件不超过1kb。
计分板:
Old Stager: 2
Marius: 1
Random 8020: 0