예제 #1
0
	game.Current_Qrt = 1
	replica = False
	nReplica = 0
	for drive in drives:	# loop through all drives in the game
		for play in drive.Raw_Pbp_Data:		# loop through all plays in the drive
			game.Check_Points(play)
			game.Set_Quarter(play)
			# Set offense and defense points
			if drive.Offense == game.Home:
				off_pnts = game.Home_Pts
				def_pnts = game.Visitor_Pts
			elif drive.Offense == game.Visitor:
				off_pnts = game.Visitor_Pts	
				def_pnts = game.Home_Pts
			# Create play	
			cur_play = Play_Stats(game.Code, len(plays) + 1, game.Current_Qrt, drive.Start_Time, drive.Offense, drive.Defense, off_pnts, def_pnts, drive.Drive_Num)
			try:
				prev_play = plays[len(plays) - 1]
			except:
				prev_play = Play_Stats(0, 0, 0, 0, 0, 0, 0, 0, 0)
			if cur_play.Extract_Play_Data(play, prev_play,cur_play.ESPN_Parser):
				try:
					if cur_play.Drive_Number == plays[len(plays) - 1].Drive_Number + 1:
						cur_play.Drive_Play = 1
					else:
						cur_play.Drive_Play = plays[len(plays) - 1].Drive_Play + 1
				except:
					cur_play.Drive_Play = 1

				# check to make sure this play isn't a replica
				if replica:
예제 #2
0
	# Parse data into play form
	plays = []
	game.Current_Qrt = 1
	for drive in drives:	# loop through all drives in the game
		for play in drive.Raw_Pbp_Data:		# loop through all plays in the drive
			game.Check_Points(play)
			game.Set_Quarter(play)
			# Set offense and defense points
			if drive.Offense == game.Home:
				off_pnts = game.Home_Pts
				def_pnts = game.Visitor_Pts
			elif drive.Offense == game.Visitor:
				off_pnts = game.Visitor_Pts	
				def_pnts = game.Home_Pts
			# Create play	
			cur_play = Play_Stats(game.Code, len(plays) + 1, game.Current_Qrt, drive.Start_Time, drive.Offense, drive.Defense, off_pnts, def_pnts, drive.Drive_Num)
			try:
				prev_play = plays[len(plays) - 1]
			except:
				prev_play = Play_Stats(0, 0, 0, 0, 0, 0, 0, 0, 0)
			if cur_play.Extract_Play_Data(play, prev_play):
				try:
					if cur_play.Drive_Number == plays[len(plays) - 1].Drive_Number + 1:
						cur_play.Drive_Play = 1
					else:
						cur_play.Drive_Play = plays[len(plays) - 1].Drive_Play + 1
				except:
					cur_play.Drive_Play = 1
				plays.append(cur_play)
				allPlays.append(cur_play)
				drive.Play_List.append(cur_play)
예제 #3
0
def DictToPlay(play):
	newplay = Play_Stats(0, 0, 0, 0, 0, 0, 0, 0, 0)
	if play == False:
		return newplay
	newplay.Game_Code =play['Game Code']
	newplay.Play_Number=int(play['Play Number'])
	newplay.Period_Number =int(play['Period Number'])
	newplay.Drive_Start =play['Drive Start']
	try:
		newplay.Offense =play['Offense Team Code']
		newplay.Defense =play['Defense Team Code']
	except:
		newplay.Offense =play['Offense']
		newplay.Defense =play['Defense']
	try:
		newplay.Off_Points =int(play['Offense Points'])
		newplay.Def_Points =int(play['Defense Points'])
	except:
		newplay.Off_Points =int(play['Off Points'])
		newplay.Def_Points =int(play['Def Points'])
	newplay.Down =int(play['Down'])  if play['Down'] != '' else 0
	newplay.Distance =int(play['Distance'])  if play['Distance'] != '' else 0
	newplay.Spot =int(play['Spot']) if play['Spot'] != '' else 0
	newplay.Play_Type =play['Play Type']
	newplay.Drive_Number =int(play['Drive Number']) if play['Drive Number'] != '' else 0
	newplay.Drive_Play =int(play['Drive Play']) if play['Drive Play'] != '' else 0
	newplay.Play_Desc =play['Play Desc']
	newplay.Play_Result =play['Play Result']
	newplay.Yards_Gained =int(play['Yards Gained'])
	newplay.Off_Touchdown =int(play['Off Touchdown'])
	newplay.Def_Touchdown =int(play['Def Touchdown'])
	newplay.First_Down =int(play['First Down'])
	newplay.Completion =int(play['Completion'])
	newplay.Interception =int(play['Interception'])
	newplay.Fumble =int(play['Fumble'])
	newplay.Fumble_Lost =int(play['Fumble Lost'])
	newplay.Kick_Good =int(play['Kick Good'])
	newplay.TwoPt_Good =int(play['TwoPt Good'])
	newplay.Safety =int(play['Safety'])
	newplay.Kick_Yards =int(play['Kick Yards'])
	newplay.Touchback =int(play['Touchback'])
	newplay.Kickoff_OOB =int(play['Kickoff OOB'])
	newplay.Kickoff_Onsides =int(play['Kickoff Onsides'])
	newplay.Kick_Blocked =int(play['Kick Blocked'])
	newplay.Penalty =int(play['Penalty'])
	newplay.Penalty_Type =play['Penalty Type']
	newplay.No_Play =int(play['No Play'])
	newplay.Rusher =play['Rusher']
	newplay.Passer =play['Passer']
	newplay.Receiver =play['Receiver']
	newplay.Kicker =play['Kicker']
	try:
		newplay.Forced_Fum =play['Forced Fum']
	except:
		newplay.Forced_Fum =play['Forced_Fum']
	newplay.Interceptor =play['Interceptor']
	newplay.Sacker =play['Sacker']
	newplay.Extra_Pt_Att =int(play['Extra Pt Att'])
	newplay.TwoPt_Att =int(play['TwoPt Att'])
	newplay.Unparsed =play['Unparsed Play Desc']
	return newplay
예제 #4
0
 nReplica = 0
 for drive in drives:  # loop through all drives in the game
     for play in drive.Raw_Pbp_Data:  # loop through all plays in the drive
         game.Check_Points(play)
         game.Set_Quarter(play)
         # Set offense and defense points
         if drive.Offense == game.Home:
             off_pnts = game.Home_Pts
             def_pnts = game.Visitor_Pts
         elif drive.Offense == game.Visitor:
             off_pnts = game.Visitor_Pts
             def_pnts = game.Home_Pts
         # Create play
         cur_play = Play_Stats(game.Code,
                               len(plays) + 1, game.Current_Qrt,
                               drive.Start_Time, drive.Offense,
                               drive.Defense, off_pnts, def_pnts,
                               drive.Drive_Num)
         try:
             prev_play = plays[len(plays) - 1]
         except:
             prev_play = Play_Stats(0, 0, 0, 0, 0, 0, 0, 0, 0)
         if cur_play.Extract_Play_Data(play, prev_play):
             try:
                 if cur_play.Drive_Number == plays[len(plays) -
                                                   1].Drive_Number + 1:
                     cur_play.Drive_Play = 1
                 else:
                     cur_play.Drive_Play = plays[len(plays) -
                                                 1].Drive_Play + 1
             except: