ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

Tournament panicked trying to show hands_won at showdown #603

Closed ctm closed 3 years ago

ctm commented 3 years ago
AIYAH❗: Bug report: 3 players left in NLH 2019. One on vacation, she is all in for less than the blind or ante. Game is frozen. I don't think she can come back from vacation. Game is frozen.
AIYAH❗: Dealing #182564: 6000 12000 No-Limit Texas Hold’em (High only)
AIYAH❗: Dealing #182564: 6000 12000 No-Limit Texas Hold’em (High only) 🎴NNR13 antes 1250 as the big blind and is all-in AIYAH❗ blinds 6000 🎴NNR13 is all in and does not post a blind 🎴NNR13 folds due to being on vacation 4 [🎴NNR13] 0 1250 [ 0
AIYAH❗: LingCod calls It is 6000 to you AIYAH❗ calls 4 [🎴NNR13] 0 1250 [ 0] 6 B LingCod 99250 12000 [ ] [ ] 8 > AIYAH❗ 275500 12000 [ ] [ ] Board: Tc 6d Jd My cards are: [7c] [Js] It is 0 to you AIYAH
🎴NNR13: sorry it was probably my fault, but playing heads up in poker stars, it wouldn't let me do anything in mb2
🎴NNR13: so I had to go on vacation and then couldn't get out of it, even before I froze
kidZee: it doesn't look like it was your vacation that froze it, Nancy
🎴NNR13: rather I couldn't come back from vacation, even before the game froze
kidZee: the program was running fine right up to the point where it should have awarded the main pot to AIYAH
deadhead: Yipes. I will look at this later today. I'm a bit tired from "hiking" "all day" Saturday.
2021-05-07T15:13:45.612035668Z messages: []
2021-05-09T04:43:29.570905283Z thread '<unnamed>' panicked at 'index out of bounds: the len is 3 but the index is 3', lib/commands/src/game.rs:235:46
2021-05-09T04:43:29.579277805Z stack backtrace:
...
2021-05-09T04:43:30.333141629Z                                at /usr/src/poker/lib/commands/src/game.rs:235:46
2021-05-09T04:43:30.333151109Z   20:     0x55f5ab1f3c03 - core::iter::adapters::map::map_fold::{{closure}}::h6128e5301b496b2d
...
2021-05-09T04:43:30.341096816Z                                at /usr/src/poker/lib/commands/src/game.rs:233:37
2021-05-09T04:43:30.342717054Z   40:     0x55f5ab1e1a9c - <mb2_commands::game::hold_em::HoldEm as mb2_commands::game_group::GameGroup>::hand_winnings::ha6159791f1e9a93d
2021-05-09T04:43:30.342738774Z                                at /usr/src/poker/lib/commands/src/game/hold_em.rs:89:25
2021-05-09T04:43:30.400461845Z   41:     0x55f5ab0eecb6 - mb2::table::Table::showdown::h4b07d2f0fc4ad408
2021-05-09T04:43:30.400631297Z                                at /usr/src/poker/mb2/src/table.rs:1943:40
2021-05-09T04:43:30.421736058Z   42:     0x55f5aaf8d8d2 - <mb2::table::Table as mb2::table::NextActions>::award_uncontested::h6d3c58f22b069b40
2021-05-09T04:43:30.421760868Z                                at /usr/src/poker/mb2/src/table.rs:3756:9

The issue is that award_uncontested is trying to look at a board that doesn't exist. This should be trivial to find and fix.

ctm commented 3 years ago

It was table 2802.

ctm commented 3 years ago

It's a big blind ante issue. Specifically, when I implemented big blind antes, vacationed players could still win the pot. When I made it so vacationed players couldn't win the pot, I never thought about the fact that big blind antes are treated specially.

That explains why this didn't show up previously, very few structures that people play have big blind antes.

ctm commented 3 years ago

Fixed. Deploying now. Here's the comment I added to the slightly rejiggered code:

    // If there's a solo ante, then it will create a separate pot if
    // the player who posted the solo ante is all-in and still live.
    // It is possible for the player who goes all-in on a solo ante to
    // not be live if that player is on vacation.
    //
    // So, solo_ante_amount is the amount we're going to add to the
    // main pot if and only if no separate pot for the solo ante is
    // created.  If there's no solo ante, or if a separate pot for the
    // solo ante is created, then solo_ante_amount will be 0.