john1571 / RoboPoker

Arena for poker playing computer programs to play against each other.
1 stars 2 forks source link

Value error bug when all players have folded or gone all-in #49

Closed john1571 closed 1 year ago

john1571 commented 1 year ago

Describe the bug During payout, the program can crash with a ValueError: min() arg is an empty sequence

Causal Issue Unsure

To Reproduce See additional context.

Solutiuon Create a unit test that walks through the scenario report under Additional context. Ensure that we hit the issue. Diagnose it and fix.

Additional context Bug was seen in following round:

Round: 7 Pot: 5 Table: Names: | >Adam | Ben | Caleb | Dan | Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 985 | 60 | 940 | 105 | 1675 |
Hands: | 5♣ K♠ | 5♠ 9♦ | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | hi card | hi card | hi card | hi card | hi card | hi card |
Bets: | 5 | 0 | 0 | 0 | 0 | 0 |

Stats: Names: | >Adam | Ben | Caleb | Dan | Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 15 Table: Names: | Adam | >Ben | Caleb | Dan | Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 60 | 940 | 105 | 1675 |
Hands: | 5♣ K♠ | 5♠ 9♦ | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | hi card | hi card | hi card | hi card | hi card | hi card |
Bets: | 5 | 10 | 0 | 0 | 0 | 0 |

Stats: Names: | Adam | >Ben | Caleb | Dan | Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 35 Table: Names: | Adam | Ben | >Caleb | Dan | Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 40 | 940 | 105 | 1675 |
Hands: | 5♣ K♠ | 5♠ 9♦ | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | hi card | hi card | hi card | hi card | hi card | hi card |
Bets: | 5 | 10 | 20 | 0 | 0 | 0 |

Stats: Names: | Adam | Ben | >Caleb | Dan | Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 75 Table: Names: | Adam | Ben | Caleb | >Dan | Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 40 | 900 | 105 | 1675 |
Hands: | 5♣ K♠ | 5♠ 9♦ | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | hi card | hi card | hi card | hi card | hi card | hi card |
Bets: | 5 | 10 | 20 | 40 | 0 | 0 |

Stats: Names: | Adam | Ben | Caleb | >Dan | Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 115 Table: Names: | Adam | Ben | Caleb | Dan | >Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 40 | 900 | 65 | 1675 |
Hands: | 5♣ K♠ | 5♠ 9♦ | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | hi card | hi card | hi card | hi card | hi card | hi card |
Bets: | 5 | 10 | 20 | 40 | 40 | 0 |

Stats: Names: | Adam | Ben | Caleb | Dan | >Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 155 Table: Names: | Adam | Ben | Caleb | Dan | Eli | >Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 40 | 900 | 65 | 1635 |
Hands: | 5♣ K♠ | 5♠ 9♦ | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | hi card | hi card | hi card | hi card | hi card | hi card |
Bets: | 5 | 10 | 20 | 40 | 40 | 40 |

Stats: Names: | Adam | Ben | Caleb | Dan | Eli | >Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 155 Table: Names: | >Adam | Ben | Caleb | Dan | Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 40 | 900 | 65 | 1635 |
Hands: | -- | 5♠ 9♦ | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | -- | hi card | hi card | hi card | hi card | hi card |
Bets: | fold | 10 | 20 | 40 | 40 | 40 |

Stats: Names: | >Adam | Ben | Caleb | Dan | Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 155 Table: Names: | Adam | >Ben | Caleb | Dan | Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 40 | 900 | 65 | 1635 |
Hands: | -- | -- | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | -- | -- | hi card | hi card | hi card | hi card |
Bets: | fold | fold | 20 | 40 | 40 | 40 |

Stats: Names: | Adam | >Ben | Caleb | Dan | Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 195 Table: Names: | Adam | Ben | >Caleb | Dan | Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 0 | 900 | 65 | 1635 |
Hands: | -- | -- | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | -- | -- | hi card | hi card | hi card | hi card |
Bets: | fold | fold | 60 | 40 | 40 | 40 |

Stats: Names: | Adam | Ben | >Caleb | Dan | Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 275 Table: Names: | Adam | Ben | Caleb | >Dan | Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 0 | 820 | 65 | 1635 |
Hands: | -- | -- | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | -- | -- | hi card | hi card | hi card | hi card |
Bets: | fold | fold | 60 | 120 | 40 | 40 |

Stats: Names: | Adam | Ben | Caleb | >Dan | Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 340 Table: Names: | Adam | Ben | Caleb | Dan | >Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 0 | 820 | 0 | 1635 |
Hands: | -- | -- | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | K♥ T♦ |
Values: | -- | -- | hi card | hi card | hi card | hi card |
Bets: | fold | fold | 60 | 120 | 105 | 40 |

Stats: Names: | Adam | Ben | Caleb | Dan | >Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Round: 7 Pot: 340 Table: Names: | Adam | Ben | Caleb | Dan | Eli | >Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 0 | 820 | 0 | 1635 |
Hands: | -- | -- | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | -- |
Values: | -- | -- | hi card | hi card | hi card | -- |
Bets: | fold | fold | 60 | 120 | 105 | fold |

Stats: Names: | Adam | Ben | Caleb | Dan | Eli | >Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Pot: 340 Table: Names: | Adam | Ben | Caleb | Dan | Eli | Frank | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | bot1 | base_pla |
Chips: | 3230 | 975 | 0 | 820 | 0 | -- | 1635 |
Hands: | -- | -- | 4♦ 7♠ | A♥ 7♦ | 8♣ 6♥ | | -- |
Values: | -- | -- | hi card | hi card | hi card | | -- |
Bets: | fold | fold | 60 | 120 | 105 | | fold |

Stats: Names: | Adam | Ben | Caleb | Dan | Eli | Frank | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | -143 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 340 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -223 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %14 | %43 |

Round: 7 Pot: 340 Table: 3♦ 7♣ 8♥ Names: | Adam | Ben | Caleb | >Dan | Eli | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | base_pla |
Chips: | 3230 | 975 | 0 | 820 | 0 | 1635 |
Hands: | -- | -- | 4♦ 7♠ | -- | 8♣ 6♥ | -- |
Values: | -- | -- | pair | -- | pair | -- |
Bets: | fold | fold | 0 | fold | 0 | fold |

Stats: Names: | Adam | Ben | Caleb | >Dan | Eli | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %43 |

Pot: 340 Table: 3♦ 7♣ 8♥ Names: | Adam | Ben | Caleb | Dan | Eli | Frank | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | bot1 | base_pla |
Chips: | 3230 | 975 | 0 | 820 | 0 | -- | 1635 |
Hands: | -- | -- | 4♦ 7♠ | -- | 8♣ 6♥ | | -- |
Values: | -- | -- | pair | -- | pair | | -- |
Bets: | fold | fold | 0 | fold | 0 | | fold |

Stats: Names: | Adam | Ben | Caleb | Dan | Eli | Frank | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | -143 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 340 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -223 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %14 | %43 |

Pot: 340 Table: 3♦ 7♣ 8♥ K♦ Names: | Adam | Ben | Caleb | Dan | Eli | Frank | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | bot1 | base_pla |
Chips: | 3230 | 975 | 0 | 820 | 0 | -- | 1635 |
Hands: | -- | -- | 4♦ 7♠ | -- | 8♣ 6♥ | | -- |
Values: | -- | -- | pair | -- | pair | | -- |
Bets: | fold | fold | 0 | fold | 0 | | fold |

Stats: Names: | Adam | Ben | Caleb | Dan | Eli | Frank | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | -143 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 340 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -223 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %14 | %43 |

Pot: 340 Table: 3♦ 7♣ 8♥ K♦ J♠ Names: | Adam | Ben | Caleb | Dan | Eli | Frank | Gad |
Bots: | Call-Kil | bot3 | bot2 | Bot4 | Calling | bot1 | base_pla |
Chips: | 3230 | 975 | 0 | 820 | 0 | -- | 1635 |
Hands: | -- | -- | 4♦ 7♠ | -- | 8♣ 6♥ | | -- |
Values: | -- | -- | pair | -- | pair | | -- |
Bets: | fold | fold | 0 | fold | 0 | | fold |

Stats: Names: | Adam | Ben | Caleb | Dan | Eli | Frank | Gad |
Last: | 2380 | -10 | -855 | 0 | -855 | | -30 |
Av. D.: | 319 | -2 | -134 | -9 | -128 | -143 | 96 |
Av. W.: | 2380 | 0 | 605 | 0 | 650 | 340 | 297 |
Av. L.: | -24 | -8 | -258 | -20 | -258 | -223 | -54 |
Win %: | %14 | %0 | %14 | %0 | %14 | %14 | %43 |
Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pydev\pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm 2021.3\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/johnpaul.jones/PycharmProjects/PokerInterface3/main.py", line 225, in play(7) File "C:/Users/johnpaul.jones/PycharmProjects/PokerInterface3/main.py", line 208, in play deal_round(round_num, dealer_num, all_players, big_blind) File "C:/Users/johnpaul.jones/PycharmProjects/PokerInterface3/main.py", line 167, in deal_round pot = gp.payout_new(players) File "C:\Users\johnpaul.jones\PycharmProjects\PokerInterface3\game_play.py", line 102, in payout_new lowest_winner = get_lowest_winner(players, winners) File "C:\Users\johnpaul.jones\PycharmProjects\PokerInterface3\game_play.py", line 60, in get_lowest_winner if min(side_pots.keys()) == max(side_pots.keys()) and min(side_pots.keys()) == get_current_pot(players): ValueError: min() arg is an empty sequence