Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes raises are not called #59

Closed
charleskawczynski opened this issue May 13, 2021 · 5 comments · Fixed by #62
Closed

Sometimes raises are not called #59

charleskawczynski opened this issue May 13, 2021 · 5 comments · Fixed by #62
Labels
bug 🐛 Something isn't working

Comments

@charleskawczynski
Copy link
Owner

charleskawczynski commented May 13, 2021

As of #58, there is a relatively rare bug (1 in ~1000 games?) that is caught from the fuzz tests. Here is the log:

[ Info: ********************************
[ Info: ******************************** Playing Game!
[ Info: ********************************
[ Info: Initial bank roll summary: (200.0, 200.0, 200.0)
[ Info: Bot5050[2] paid the small blind and dealt cards: (J♠, K♠)
[ Info: Bot5050[3] paid the  big  blind and dealt cards: (5♢, 6♢)
[ Info: Bot5050[1] dealt (free) cards:                   (7♣, 7♡)
[ Info: Table cards dealt (face-down).
[ Info: Bot5050[1] called 2.0 (blind).
[ Info: Bot5050[2] called 1.0 (blind).
[ Info: Bot5050[3] checked!
[ Info: Flop:                                              (9♡, 3♢, 4♣)
[ Info: Bot5050[1] checked!
[ Info: Bot5050[2] checked!
[ Info: Bot5050[3] raised to 83.0.
[ Info: Bot5050[1] called 83.0.
[ Info: Bot5050[2] raised to 166.0.
[ Info: Bot5050[3] folded!
[ Info: Turn:                                              J♡
[ Info: Bot5050[1] checked!
[ Info: Bot5050[2] raised to 18.0.
[ Info: Bot5050[1] raised to 61.0.
[ Info: Bot5050[2] called 14.0 (now all-in).
[ Info: River:                                             4♠
Game: Play (3 Bot5050's): Error During Test at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/test/fuzz_play.jl:6
  Got exception outside of a @test
  AssertionError: amt_remaining ≈ 0
  Stacktrace:
   [1] contribute!(::Table, ::Player{Bot5050}, ::Float64, ::Bool) at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/src/transactions.jl:137
   [2] raise_to_valid_raise_amount!(::Table, ::Player{Bot5050}, ::Float64) at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/src/player_actions.jl:186
   [3] raise_to! at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/src/player_actions.jl:180 [inlined]
   [4] raise_to!(::Game, ::Player{Bot5050}, ::Float64) at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/src/player_actions.jl:178
   [5] player_option!(::Game, ::Player{Bot5050}, ::River, ::CheckRaiseFold) at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/src/player_options.jl:130
   [6] player_option!(::Game, ::Player{Bot5050}) at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/src/player_options.jl:28
   [7] act_generic!(::Game, ::River) at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/src/game.jl:106
   [8] act! at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/src/game.jl:112 [inlined]
   [9] play(::Game) at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/src/game.jl:149
   [10] top-level scope at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/test/fuzz_play.jl:8
   [11] top-level scope at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Test/src/Test.jl:1113
   [12] top-level scope at /Users/runner/work/TexasHoldem.jl/TexasHoldem.jl/test/fuzz_play.jl:7

It seems that the first issue here is that the Bot5050[2] raise to 166.0. is not called by Bot5050[1]. This demos something we can check for: if all BRs are equal to start, then any all-in should lead to everyone (still playing) being all in.

@charleskawczynski charleskawczynski added the bug 🐛 Something isn't working label May 13, 2021
@bors bors bot closed this as completed in a2b484e May 13, 2021
@charleskawczynski
Copy link
Owner Author

charleskawczynski commented May 23, 2021

Not sure if this is only isolated to tournament! play, introduced in #67, but it seems that this bug has somehow returned:

[ Info: Human[1] called 4.0.
[ Info: River:                                             2♡
Human[1]'s turn to act:
 > Check
   Raise [$1.0, $1.0]
   Fold
[ Info: Human[1] checked!
[ Info: Bot5050[2] raised to 1.0 (all-in).
[ Info: Human[1] wins $195.0 ($98.0 profit) with TwoPair!
[ Info: Final bank roll summary: (200.0, 0.0)

There's probably a simple way to check for this in the transaction manager. It might be good to add a bot test, if easy/possible, to protect against this.

bors bot added a commit that referenced this issue May 24, 2021
69: Re-fix 59, throw error if breaks again r=charleskawczynski a=charleskawczynski

#67 re-introduced #59. This PR closes #59, and throws an error if it breaks.

Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
bors bot added a commit that referenced this issue May 24, 2021
69: Re-fix 59, throw error if breaks again r=charleskawczynski a=charleskawczynski

#67 re-introduced #59. This PR closes #59, and throws an error if it breaks.

Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
@charleskawczynski
Copy link
Owner Author

We should probably fix #72 / #73 first, since these affect flow control and game logic.

bors bot added a commit that referenced this issue Jun 8, 2021
82: Add tournament play fuzz test back in r=charleskawczynski a=charleskawczynski

I was trying to reproduce #59, but I'm not seeing it anymore. It may have been eliminated from all of the fixups with `folder` -> `active`/`still_playing` changes.

Co-authored-by: Charles Kawczynski <kawczynski.charles@gmail.com>
@charleskawczynski
Copy link
Owner Author

Hmm, raises don't always need to be called, and I'm not seeing this error anymore. Closing for now.

@charleskawczynski
Copy link
Owner Author

Okay, okay, there is still a bug. Good news though, I think I have a dev branch where I’m tracking down the problems.

@charleskawczynski
Copy link
Owner Author

I think this was closed by #85. We'll reopen if that's not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
1 participant