Bunco Simulator

Check-in [d96413]
Overview
Comment:Ensure team is properly credited when a player has to finish up after round ends
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d96413349c1df8b62f7bf4a0951fc2346f8a5c9d9542261c93ba854e02f07edb
User & Date: joel on 2018-11-22 03:07:51
Other Links: manifest | tags
Context
2018-11-22
04:04
Fix bug that prevented tracking fuzzy die check-in: 7a0a5b user: joel tags: trunk
03:07
Ensure team is properly credited when a player has to finish up after round ends check-in: d96413 user: joel tags: trunk
2018-11-21
23:02
Move I/O out of game API into a proper app (closes [c68bc6d850]) check-in: c760b2 user: joel tags: trunk
Changes

Modified bunco.py from [8b36c5] to [15d7f1].

330
331
332
333
334
335
336
337
338
339
340
341






342
343
344
345
346
347
348
330
331
332
333
334
335
336





337
338
339
340
341
342
343
344
345
346
347
348
349







-
-
-
-
-
+
+
+
+
+
+







        # Go until one of the head table teams reaches 21 pts
        while max(self.tables[0].team1_score, self.tables[0].team2_score) < 21:
            self.tick()

        log("all", "BUNCO!! A team at the Head Table has hit 21 points.")
        
        # Finish up scoring for any players that have unscored rolls
        for player in self.players:
            if player.current_roll:
                log(player, f"{player} finishing up [their] turn")
                while player.current_roll:
                    player.tick()
        for table in self.tables:
            curplayer = table.players[table.active_player]
            if curplayer.current_roll:
                log(curplayer, f"{curplayer} finishing up [their] turn")
                while curplayer.current_roll:
                    table.tick()
                    self.increment_tick()
        
        # Settle ties at each table by doing a roll-off as many times as needed
        for table in self.tables:
            while table.team1_score == table.team2_score:
                log('all', f"{table} having a roll-off to resolve a tie")
                table.roll_off()