dominion_chapel_strategy.py
#coding: UTF-8
#Information on 5 or more cards with Dominion's compression strategy(Silver, gold, province chapel)A program that returns the average number of turns from that state to buying 5 provinces.
#Experiment manually as appropriate. It is quite idealized, so please use it as a reference.
#According to the program below, the conclusion is, "Whenever you can buy a province, buy it. If not, mana boost.(Gold in this case)Let's buy it. "
#I think this depends on the compression strategy, but think about it yourself.
#As a result of chokudai's analytical solution, it is correct to move to the above strategy after buying 3 Gs.
import random
moto = ['s','s','s','g','z']#s is a silver coin, g is a gold coin, z is a province and chapel
lib = moto[:]
answer = 0.0
division = 0.0
turn = 0.0
while division < 3000:
if lib.count('z') == 6:
answer = answer + turn
division = division + 1.0
lib = moto[:]
turn = 0
list = random.sample(lib,5)
point = 3 * list.count('g') + 2 * list.count('s')
if point >= 8:
lib.append('z')
if point == 6 or point == 7:
lib.append('g')
turn = turn + 1
print answer / division
Recommended Posts