Пример #1
0
 def reinit(self, includeFlags=6):
     Power.reinit(self, includeFlags)
     #	-----------------------------------
     #	Initialize the transient parameters
     #	-----------------------------------
     if includeFlags & 5:
         self.list, self.notes = {'SOONER': [], 'LATER': []}, {}
Пример #2
0
	def reinit(self, includeFlags = 6):
		Power.reinit(self, includeFlags)
		#	-----------------------------------
		#	Initialize the transient parameters
		#	-----------------------------------
		if includeFlags & 5:
			self.list, self.notes = {'SOONER': [], 'LATER': []}, {}
Пример #3
0
	def reinit(self, includeFlags = 6):
		Power.reinit(self, includeFlags)
		#	-----------------------------------
		#	Initialize the transient parameters
		#	-----------------------------------
		if includeFlags & 5:
			self.orders = {}
Пример #4
0
	def initialize(self, game):
		Power.initialize(self, game)
		if 'VASSAL_DUMMIES' in game.rules and self.isDummy(): return
		victory = game.victory[0]
		if self.abbrev:
			if 'ZEROSUM' in game.rules: self.funds['+'] = 10 * len(self.centers)
			self.balance = (self.income(len(self.centers))
						or (victory >> 1) * len(self.units))
			self.initAccept()
		elif self.type == 'INVESTOR': self.balance = 0
Пример #5
0
	def __repr__(self):
		text = Power.__repr__(self).decode('latin-1')
		if self.elect:
			text += 'ELECT %s\n' % ' '.join(map(':'.join, self.elect.items()))
		for power in self.sent: text += 'SENT %s\n' % power
		if self.accept and not self.isEliminated(False, True):
			text += 'ACCEPT %s\n' % self.accept
		if self.state: text += 'STATE %s\n' % self.state
		for offer in self.sheet: text += '%s\n' % offer
		return text.encode('latin-1')
Пример #6
0
	def isEliminated(self, public = False, personal = False):
		if not Power.isEliminated(self, public, personal): return False
		if not (self.homes and self.game.phase == 'M' and
			'GARRISON' in self.game.rules): return True
		save = next = self.game.phase
		while next not in 'AM':
			self.game.phase = self.game.findNextPhase()
			next = self.game.phase.split()[-1][0]
		self.game.phase = save
		return next != 'A'
Пример #7
0
 def isEliminated(self, public=False, personal=False):
     if not Power.isEliminated(self, public, personal): return False
     if not (self.homes and self.game.phase == 'M'
             and 'GARRISON' in self.game.rules):
         return True
     save = next = self.game.phase
     while next not in 'AM':
         self.game.phase = self.game.findNextPhase()
         next = self.game.phase.split()[-1][0]
     self.game.phase = save
     return next != 'A'
Пример #8
0
	def reinit(self, includeFlags = 6):
		Power.reinit(self, includeFlags)
		#	-----------------------------------
		#	Initialize the transient parameters
		#	-----------------------------------
		if includeFlags & 4:
			self.overpaid, self.offers, self.sent = 0, [], []
			self.accept = self.fullAccept = None
		if includeFlags & 5:
			self.sheet = []
		self.liquid = self.left = None
		#	----------------------------------------------
		#	The two attributes below are ZeroSum-specific
		#	----------------------------------------------
		self.gained, self.lost = [], []
		#	-------------------------------------------
		#	And here are two that are Exchange-specific
		#	-------------------------------------------
		if includeFlags & 4:
			self.elect, self.state = {}, ''
Пример #9
0
	def __repr__(self):
		text = Power.__repr__(self).decode('latin-1')
		if self.orders: text += 'ORDERS\n'
		for unit, order in self.orders.items():
			#	-----------------------------
			#	Handle "REORDER", "INVALID",
			#	and "ORDER" (NO_CHECK) orders
			#	-----------------------------
			if unit[0] not in 'RIO': text += unit + ' '
			text += order + '\n'
		return text.encode('latin-1')
Пример #10
0
 def __repr__(self):
     text = Power.__repr__(self).decode('latin-1')
     for listName, orders in self.list.items():
         if orders: text += '%s\n%s\n' % (listName, '\n'.join(orders))
     return text.encode('latin-1')
Пример #11
0
 def __init__(self, game, name, type=None):
     Power.__init__(self, game, name, type)
Пример #12
0
	def isEliminated(self, public = False, personal = False):
		return (personal or not self.balance) and Power.isEliminated(
			self, public, personal)
Пример #13
0
	def resign(self, gmResign = 0):
		if not self.centers: self.balance = 0
		Power.resign(self, gmResign)
Пример #14
0
	def __repr__(self):
		text = Power.__repr__(self).decode('latin-1')
		for listName, orders in self.list.items():
			if orders: text += '%s\n%s\n' % (listName, '\n'.join(orders))
		return text.encode('latin-1')
Пример #15
0
	def __init__(self, game, name, type = None):
		Power.__init__(self, game, name, type)