Beispiel #1
0
	def fillBracket(self, xml, playerList):
		# find matches in xml head
		print "fill bracket"
		for matches in xml.findall('.Bracket/Matches/Match'):
			p1 = matches.find('.Player1').text
			p2 = matches.find('.Player2').text
			gameRound = matches.find('.Round').text
			number = matches.find('.Number').text
			player1 = playerList[p1]
			player2 = playerList[p2]
			# is there a mapping function for finding stuff in arrays without loops
			matchDesc = match.Match(player1, player2, "SampleGame", "Sample", int(gameRound), number)
	

			matchDesc.setWinner(playerList[matches.find('.Winner').text]) 
			self.allMatches.append(matchDesc)
			if matchDesc.getWinner().name == "N/A":
				# this needs to make a new Match object
				# and push into the array
				self.unfinishedMatches.append(matchDesc)
			else:
				#print matchDesc.player1.name, " ", matchDesc.player2.name, " ", matchDesc.bracketRound, " ", matchDesc.matchNumber
				if matchDesc.player1.name != "Bye" and matchDesc.player2.name != "Bye":
					#print "Add!"
					self.completedMatches.append(matchDesc)
Beispiel #2
0
import matches
import result
import text

book = text.prepare("dg.txt", "[^a-zA-Z]+")
dictionary = text.prepare("front.txt", "[^a-zA-Z\n]+").split()

search_result = matches.find(book, dictionary, 400, 5000)
result.show(search_result)