本帖最后由 mebusw 于 2010-5-13 11:54 编辑
下了VB的代码看看,摘了AI部分的注释出来。发现没有很厉害的算法,不像银河的PC版AI,还弄了个神经网络出来。
Find best action to play:
1.' play throne room if we have any
2.' sort our actions by cost
a)' if I won't buy this card, then don'tplay it
b)' chapel / ambassador: only play whenthere is a curse in hand
c)' only play island is there is avictory card in hand
d)' never play remodel
e)' don't play lookout with fewer than 3cards in deck
f)' mine can only be played if you have acopper or silver in hand, and the next highest coin is available
g)' don't play moneylender without acopper
h)' don't play Outpost if we're on anextra turn
i)' only play smugglers if AI gotsomething worth more than 0
j)' remodel / ambassador / salvagers /island / trading post / upgrade need a card in hand to play
k)'only play throne room when there is another action in hand that we can play
3.' play any actions that yield more actions
4.' play shanty town
5.' if opponent gained a card costing 5 ormore, play Smugglers
6.' play Ambassador if we have any
7.' play the most expensive card left
Find best cards to buy:
1.' if we have 0 potions (and 4 coins), thenbuy a potion
2.' get a list of the most expensive thingswe can afford
a)' towards the end of the game only buyvictory points
b)'early in the game, never buy estat or duchy
c)' donot buy duke unless we already have at least 3 duchy
3.' if nothing was found to buy, try againwithout the restrictions
a)' donot add ambassador if we don't have any curses
4.' randomly choose from among the best cards