Exemplo n.º 1
0
	def makeNextMove(self, opponentsLastMove=None, myLastScore=None, opponentsLastScore=None): #I do not understand move part
		move = Move()
		
		move.addAttack(self.attack1)
		move.addAttack(self.attack2) ##
		move.addBlock(self.defence) ##
		#Commentator().setComment("blocked your move to my $this->defence... hahaha")

		if opponentsLastMove != None:
			if self.defence in opponentsLastMove.getAttacks():
				#pass
				move.setComment("blocked your move to my self->defence... hahaha")
			else:
				self.changeDefence()

		self.myScoreTotal += myLastScore #TODO:  type object 'Boxer' has no attribute 'myScoreTotal'
		self.opponentScoreTotal += opponentsLastScore

		if self.myScoreTotal < self.opponentScoreTotal:
			#move.setComment('okay, meat, me is mad now... going berserk')
			move.addAttack(self.createRandomAttack())
		else:
			move.addBlock(self.defence)

		return move
Exemplo n.º 2
0
	def makeNextMove(opponentsLastMove=None, iLost=None, iScored=None):
		if opponentsLastMove != None:
			if self.defence in opponentsLastMove.getAttacks():
				self.comment = 'haha, blocked your attack to my' + self.defence
			else:
				self.comment = 'ouch'

		self.attack2 = Kickboxer.createRandomArea()

		if opponentsLastMove != None:
			if Kickboxer.attack1 in opponentsLastMove.getBlocks():
				self.attack1 = Kickboxer.createRandomArea()

		move = Move()
		print(move.getAttacks, move.getBlocks)
		move.addAttack(self.attack1)
		move.addAttack(self.attack2)
		move.addBlock(self.defence)
		move.setComment(self.comment)
		print(move.getAttacks, move.getBlocks)
		return move
Exemplo n.º 3
0
	def parseMove(Input):
		sys.stdout.flush()
		if Input == False or Input == None:
			print("Input stream was closed")

		Input = Input.strip()
		rez = Move()

		index = 0

		while index < len(Input):
			Type = Input[index]
			index += 1
			
			#TODO
			if 'a'==Type: 
				rez.addAttack(Protocol.getArea(Input, index)); index += 1 #######?TODO
			
			elif 'b'==Type: 
				rez.addBlock(Protocol.getArea(Input, index)); index += 1 #######?TODO
			
			elif '.'==Type:
				pass

			elif 'c'==Type:
				rez.setComment(Input[index]); index = len(Input) + 1
			
			elif ' '==Type:
				pass
			
			elif r'\t'==Type:
				continue
			
			else:
				print("Unrecognized input:" + Type)
		return rez
Exemplo n.º 4
0
	def makeNextMove(self, opponentsLastMove=None, myLastScore=0, opponentsLastScore=0):
		move = Move()
		move.addAttack('NOSE')
		move.addBlock('GROIN')
		move.addBlock('NOSE')
		return move