Beispiel #1
0
	def playDeck(self, deck):
		fatalTurn = []
		for iteration in range(0, self.gameIterations):
			gameDeck = copy.deepcopy(deck)
			game = gameMechanics.gameMechanics(self.on_the_draw, gameDeck)
			game.hand = self.starting_hand(gameDeck)

			while (game.turn_count < self.maxTurns and game.opponents_life_total > 0 ):
				#print('turn {} - opp life {} - hand = {}'.format(game.turn_count + 1, game.opponents_life_total, game.hand))
				game.newTurn()
				game.playLand('mountain')
				#TODO - move casting spell mechanics into the game mechancis file.
				game.tapAllLands()
				while (game.turn.mana[3] and game.numberCardsAbleToPlay()):
					game.playCard('bolt')
				#TODO - add creatures
			fatalTurn.append(game.turn_count)
		return sum(fatalTurn)/(len(fatalTurn))
Beispiel #2
0
	def new_game(self, draw, deck):
		self.hardOpening = False;
		game = gameMechanics.gameMechanics(draw, deck)
		
		game.hand = self.starting_hand(deck)

		# Turn 1
		########
		game.newTurn()
		#print ("hand {}, size {}".format(game.hand, len(game.hand)))

		#Playing a land - assumed to hvae at least 1 in hand from mulliganing
		game.playUrzaLand()
		
		# Decide on map or star
		if "map" in game.hand and "star" in game.hand:
			# How many new tron pieces in hand?
			new_tron_in_hand = 0
			for urza_land in ["Mine", "PP", "Tower"]:
				if urza_land not in game.landpile and urza_land in game.hand:
					new_tron_in_hand += 1
			
			# 2 new pieces? Do star to look for Karn
			if new_tron_in_hand == 2:
				game.playCardSimple("star")
				self.star_opening += 1
			elif new_tron_in_hand == 1:
				game.playCardSimple("map")
				self.map_opening += 1
			elif new_tron_in_hand == 0: ###Hard openingg
				game.playCardSimple("star")
				self.hardOpening = True;
				self.hard_opening += 1
		elif "map" in game.hand:
			game.playCardSimple("map")
			self.map_opening += 1
		elif "star" in game.hand:
			game.playCardSimple("star")
			self.star_opening += 1
		else:
			self.other_opening += 1
		
		# Turn 2
		########
		game.newTurn()

		# This will be used once later
		stop_playing_stars = False
		
		#Playing a land
		game.playUrzaLand()
		
		if (game.turn.lands_to_play == 0):
			#Use your star if you have it
			if "star" in game.battlefield:
				game.useCard("star")
				if "scry" in game.hand:
					game.useCard("scry")
				else:
					if "star" in game.hand:
						game.playCardSimple("star")
						game.useCard("star")
						stop_playing_stars = True
					if "stir" in game.hand:
						game.useCard("stir")
					if "star" in game.hand and not stop_playing_stars:
						game.playCardSimple("star")
			elif "map" in game.battlefield:
				game.useCard("map")
		else:
			# No land played yet
			if "star" in game.battlefield:
				game.useCard("star")
				
				# if draw land play it
				game.playUrzaLand()

				if (game.turn.lands_to_play):
					if "stir" in game.hand:
						game.useCard("stir")
						game.playUrzaLand()
						if "star" in game.hand:
							game.playCardSimple("star")
						# End turn
				else:
					# You played a land.
					# Do you have Scrying?
					if "scry" in game.hand:
						game.useCard("scry")
					else:
						if "star" in game.hand:
							game.playCardSimple("star")
							game.useCard("star")	
							stop_playing_stars = True
						if "stir" in game.hand:
							game.useCard("stir")
						if "star" in game.hand and not stop_playing_stars:
							game.playCardSimple("star")
		if self.determine_simulation_end(game):
			return
		
		# Turn 3
		#########
		game.newTurn()
		
		#Playing a land
		game.playUrzaLand()
		
		if "star" in game.battlefield:
			game.useCard("star")

		#Playing a land
		game.playUrzaLand()
		
		#Play Karn
		if (game.checkForUrzaTron() == 3):
			game.playCardSimple("Karn")
		self.determine_simulation_end(game)
		return