in reply to Re: check my logic & a random number issue
in thread check my logic & a random number issue

While it can't hurt to add the "else... what happens here" block that you suggest for checking errors, I don't think it would ever be reached. All of that code is inside a block where $roll == $point. If $point is ever set to anything other than 4,5,6,8,9,10, the game is over on the first roll.

Another thing you might want to do is round the winnings down for each game. I'm pretty sure that's what the casinos do. And maybe make the minimum bet something more typical, like $5. In addition to making it more realistic, these two things combined might make the results very different than a simple $1 bet with no rounding. I don't feel like doing the math, though, so that's just a gut feeling.

When I've played I've won a lot by betting the minimum on the pass line and then doubling the minimum for the odds. Watch out for those bets in the middle -- they're not worth it!

  • Comment on Re: Re: check my logic & a random number issue

Replies are listed 'Best First'.
Re: Re: Re: check my logic & a random number issue
by jarich (Curate) on Oct 11, 2002 at 05:24 UTC
    Very good catch.

    My modifications to the code changed the way it worked and therefore the responses I got. My roll function allowed "1" to be returned, which ought to be impossible (with two dice). A mistake I made when making my version strict compliant prevented this mistake from showing up in my version, so I assumed it was a bug in the original code (using my roll function though).

    In which case I can't see any logic errors in the code (except perhaps for not validating the roll dice value and catching errors that shouldn't happen in that extra else statement).

    What I said about doing proper statistical analyses is still valid. ;)

    Oh, and don't take the fact that I made mistakes in a quick and dirty strict compliancy conversion to be an argument for not using strict. ;) This (as well as formatting) was sorely missed in the original version of this code.

    jarich