Ejemplo n.º 1
0
def placement():
	if not api.mon_tour():
		return
	bestval = 0
	bestpos = (-1,-1)
	for i in range(TAILLE_CARTE):
		for j in range(TAILLE_CARTE):
			if api.type_case(j,i) == VIDE and api.construction_possible(j,i) != BLOCAGE:
				val = -plus_proche_route((0,i,j))/2
				r = api.portee_monument(api.monument_en_cours())
				prestige = api.prestige_monument(api.monument_en_cours())
				for y in range(i-r,i+r+1):	
					for x in range(j-r,j+r+1):
						if not api.type_case(x,y) == MAISON:
							continue
						if api.appartenance(x,y) == 0:
							val += prestige
						else:
							val -= prestige
				if val > bestval:
					bestval = val
					bestpos = (i,j)
	if bestpos[0] < 0:
		return
	Build((0,) + bestpos, "monument")
Ejemplo n.º 2
0
def jouer():
	if not api.mon_tour():
		return
	pos = []
	for i in range(TAILLE_CARTE):
		for j in range(TAILLE_CARTE):			
			if api.type_case(j,i) == VIDE or api.type_case(j,i) == RESERVATION \
				    and api.appartenance(j,i) == 0 and api.construction_possible(j,i) != BLOCAGE:
				v = api.valeur_case(j,i) - plus_proche_route((0,i,j));
				pos.append((v, i, j));
	pos.sort()
	for k in range(2):
		c = pos.pop()
		Build(c, "maison")
	if api.numero_tour() == 15:
		print "******** Python Final score = ", api.score(0) + api.finances(0), " **********"