1. Larry Hastings
  2. mille

Commits

Larry Hastings  committed 25b5e29

Statistics are... done! I think!

  • Participants
  • Parent commits e9571ce
  • Branches default

Comments (0)

Files changed (1)

File mille.py

View file
  • Ignore whitespace
 
 	@property
 	def statistics(self):
-		return {
+		d = {
 			"mileage": self.mileage,
 			"0 safeties": self.safeties == 0,
 			"1 safeties": self.safeties == 1,
 			"delayed_actions": self.delayed_action,
 			"safe_trips": self.safe_trip,
 			"shutouts": self.shutout,
-			"perfect_games": self.total == 4600,
+			"perfect_hands": self.total == 4600,
 		}
 		return { k: int(v) for k, v in d.items() }
 
 		self.played = CardCounter()
 		self.discarded = CardCounter()
 		self.unplayed = CardCounter()
+		self.hands = CardCounter()
 
 	def game_start(self):
 		pass
 		pass
 
 	def score_hand(self, winner):
-		pass
+		h = self.player.hand
+		self.score += h.score.total
+		self.update_statistics(h)
+		self.hands.update(h.score.statistics)
 
 	def hand_end_ui(self, winner):
 		pass
 			d.update(s)
 
 
+
 class SeriesPlayerData(PlayerData):
 	"""
 	The data for a player in a Series.
 	def __init__(self, player):
 		super().__init__(player)
 		self.games_won = 0
-		self.hands_won = 0
-		self.shutouts = 0
 		self.highest_score = 0
 
 	def score_game(self, winner):
 		if winner == self.player:
 			self.games_won += 1
-		g = self.player.game
-		score = g.score
-		self.score += score
-		self.highest_score = max(self.highest_score, score)
-
-	def score_hand(self, winner):
-		if winner == self.player:
-			self.hands_won += 1
-			if not winner.others[0].hand.mileage():
-				self.shutouts += 1
-		self.update_statistics(self.player.hand)
-		
+		self.highest_score = max(self.highest_score, self.player.game.score)
 
 
 
 class GamePlayerData(PlayerData):
-
-	def score_hand(self, winner):
-		h = self.player.hand
-		self.score += h.score.total
-		self.update_statistics(h)
-
+	pass
 
 class HandPlayerData(PlayerData):
 
 
 class Hand:
 
-	over = False
-
 	def __init__(self):
 
 		self.winner = None
 			if lost_by_points:
 				add("(Which is weird, because " + loser.name + " got more points.)")
 			if not loser.hand.mileage():
-				add("And it's a shutout, #{} for {}!".format(winner.series.shutouts, winner.name))
+				add("And it's a shutout, #{} for {}!".format(winner.series.hands['shutouts'], winner.name))
 		else:
 			add("Nobody won the hand.")