Beispiel #1
0
	def run_match(self, match):
		""" run specified match """
		players = self.get_bot_commands(match.bots)
		player_names = [self.get_player_name(player) for player in match.bots]
		game_class = games.get_game(match.gamename)
		game = game_class(None, players, player_names, match.map_file)
		result = game.run_game()
		comms.send_result(match, result)
Beispiel #2
0
	def functional_test(self, gamename, submission):
		""" Run a test game for submission to see if it crashes """
		game_class = games.get_game(gamename)
		players = [(submission.directory, submission.get_command(config.worker_compiled + submission.sub_id))] * 2
		print(players)
#		players = self.get_bot_commands([submission.sub_id, submission.sub_id])
		game = game_class(None, players, [submission.username, submission.username])
		result = game.run_game()
		if 'status' in result:
			if result['status'][0] in ('crashed', 'timeout', 'invalid'):
				submission.set_test_status(False, result['status'][0] + "\n" + result['errors'][0])
			else:
				submission.set_test_status(True)
		else:
			print("status not in result:")
			print (str(result))