The team that has the most points doesn't win always...

Issue #3 resolved
Giacomo Alzetta
repo owner created an issue

The current implementation of "game_winner" and "show_winner" is buggy, and doesn't always show the correct team as winner.

Suppose you have team1 (player A and player B) and team 2 (player C and player D). Player A(team 1) wins a hand in which all players dropped an Ace. Player C(team 2) wins a hand in which all players dropped a Three. Player D(team 2) wins three hands in which all players dropped Jacks, knights and kings.

Now the points should be:

team 1: - player A: 44 points - player B: 0 points total: 44 points

team 2: - player C: 40 points - player D: 36 points total: 76 points

The winner should be team 2, but the current implementation of the two methods mentioned will say that the winner is team 1.

"game_winner" simply returns the player that has the most points(player A), and "show_winner" says that the team winner is the one that has this player.

This is due to the fact that we introduced teams later, therefore not all the methods know of them.

To change this might be appropriate to create a "Team" class and use it instead of a simple list.

PS: I already wrote a test that shows this issue: tests/test_briscola_game.TestBriscola.test_team_with_more_points_wins

Comments (2)

  1. Log in to comment