Index: bunco.py ================================================================== --- bunco.py +++ bunco.py @@ -23,10 +23,11 @@ self.max_streak = 0 self.round_bunco_counts = [0] self.round_scores = [0] self.round_roll_counts = [0] self.personal_roll_scores = [0] + self.round_wins = [0] self.turn_progress = 0 self.current_streak = 0 self.max_fuzzydie_streak = 0 self.current_fuzzydie_streak = 0 self.rolled_bunco = False @@ -43,10 +44,11 @@ def prep_new_round(self): self.round_scores.append(0) self.round_roll_counts.append(0) self.personal_roll_scores.append(0) self.round_bunco_counts.append(0) + self.round_wins.append(0) self.turn_progress = 0 self.current_streak = 0 def score_last_roll(self): desired_num = Game.current_round() % 6 @@ -205,10 +207,14 @@ # Player 2 move to spot 3 self.players[3] = self.players[2] # Replace middle two players self.players[1:3] = new_players return losers + + def notch_wins(self): + for player in self.winners(): + player.round_wins[Game.current_round() - 1] = 1 def prep_new_round(self): self.team1_score = 0 self.team2_score = 0 self.active_player = -1 @@ -365,10 +371,12 @@ log('all', f"{table}: Team 1 {table.team1_score} pts, Team 2 {table.team2_score} pts") while table.team1_score == table.team2_score: log('all', f"{table} having a roll-off to resolve a tie") table.roll_off() log('all', f"{table}: Team 1 {table.team1_score} pts, Team 2 {table.team2_score} pts") + + table.notch_wins() log_db = sqlite3.connect("bunco.sqlite") log_dbc = log_db.cursor() def run_query(*args): Index: bunco_app.py ================================================================== --- bunco_app.py +++ bunco_app.py @@ -120,11 +120,16 @@ ws.write(row, 0, player.name, row_heading) for r in range(g.current_round()): col = r + 1 ws.write(row, col, player.round_scores[r], score_style) + + # derive losses from wins + losses = [int(not x) for x in player.round_wins] ws.write(row, end_col + 1, sum(player.round_scores), total_style) + ws.write(row, end_col + 2, sum(player.round_wins), total_style) + ws.write(row, end_col + 3, sum(losses), total_style) ws.write(row, end_col + 4, sum(player.round_bunco_counts), total_style) ws.write(row, end_col + 5, sum(player.round_roll_counts), total_style) wb.close()