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

place68 question #31

Open
amortization opened this issue May 24, 2022 · 2 comments
Open

place68 question #31

amortization opened this issue May 24, 2022 · 2 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@amortization
Copy link
Collaborator

I'm working on creating integration tests for #29 and a question came up.

What I'm doing is running a script to produce data from the Master branch, and then making sure that the data in the #29 branch matches what was output from master for each strategy. It is working through the passline and passlineodds strategies, but is running into issues with place68.

The original code for place68 was

def place68(player, table, unit=5, strat_info=None):
    passline(player, table, unit, strat_info=None)
    # Place 6 and 8 when point is ON
    p_has_place_bets = player.has_bet(
        "Place4", "Place5", "Place6", "Place8", "Place9", "Place10"
    )
    if table.point == "On" and not p_has_place_bets:
        if table.point.number == 6:
            player.bet(Place8(6 / 5 * unit))
        elif table.point.number == 8:
            player.bet(Place6(6 / 5 * unit))
        else:
            player.bet(Place8(6 / 5 * unit))
            player.bet(Place6(6 / 5 * unit))

So what is happening in the original script is that if a player has a Place6 or Place8 bet that wins and gets taken down the Place6 or Place8 doesn't get left up. For example:

point = 5
last_roll = 8
bets_before = [PassLine(bet_amount=5.0), Place6(bet_amount=6.0), Place8(bet_amount=6.0)]
dice_result = (4, 4)

after running table.add_player_bets() what was originally left up was:

bets_after = [PassLine(bet_amount=5.0), Place6(bet_amount=6.0)]

What I would normally expect would be that the Place8 bet gets re-added (since normally players don't take down place bets after winning them, the dealer just gives them their winnings) so the bets_after would be:

bets_after = [Place6(bet_amount=6.0), PassLine(bet_amount=5.0), Place8(bet_amount=6.0)]

I think what is probably happening is that it's hitting this logic

    p_has_place_bets = player.has_bet(
        "Place4", "Place5", "Place6", "Place8", "Place9", "Place10"
    )
    if table.point == "On" and not p_has_place_bets:

and seeing that the player has a Place6 and not ever placing the Place8 back up. It currently would wait until the player won the Place6, and then it would put both of those bets back up. I think that the more natural expectation for this strategy would be to leave the Place8 up in this case and just take the winnings since when most people talk about placing the 6 and 8 that's what they are referring to, but it would mean that the new implementation of this strategy would differ from the original. Thoughts on this?

@amortization amortization added the question Further information is requested label May 24, 2022
@skent259 skent259 added the bug Something isn't working label May 24, 2022
@skent259
Copy link
Owner

Good catch, that's most certainly a bug. I think this strategy was written before the place bet logic was fully understood. The small problem is that I've talked about this strategy previously: https://pages.stat.wisc.edu/~kent/blog/2019.07.31_Craps_Budget/craps_best-strategies-on-a-budget.html

The question is whether this is a reasonably useful strategy for someone or not? The logic is kind of complicated, only putting new place bets up when both win or both lose.

In the new strategy syntax, a proper place 68 strategy is easily combined with BetPassLine(5) + BetPlace({6: 5, 8:5}), right? So I don't think there needs to be a formal definition of this strategy.

My inclination is to implement it, as is, but with a slightly different name. Perhaps BetPassPlace68Jointly? That way there's not really a breaking change but it's clear that this isn't the typical way the strategy would be implemented.

Thoughts?

@amortization
Copy link
Collaborator Author

Yeah, I think that leaving it but renaming it to something more clear would make the most sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants