This one is retired, v2 is in action.
Track and visualize series of attempts to use the martingale betting system in Roulette.
I recently learned of the Martingale betting system and how it's one of the popular betting systems used in roulette. I've always been a fan of number systems, especially ones that involve wagering: stocks and gambling.
There are some decent roulette apps for iOS and the Mac so I'm going to run a series of tests using the system, record data, and visualize it.
This is all manual and I'll use a couple of different apps to get different results. I've been using an app on iOS called Roulette - Casino Style and I've already noticed a couple of patterns where it repeats numbers after a win.
I do have some concerns about using these apps because they offer in-app purchases. While the odds alone would lead to plenty of purchases, it certainly seems like it would be easy to program some occasional lose streaks to help out.
In my first day of testing, my longest losings streaks came from only betting black and using the system. I'll test more to see if that is normal.
How does it work over a long series of spins?
How does it perform over short sessions with a goal of 10 wins?
What bankroll would be necessary to complete the worst session?
What bankroll would be necessary to complete the average session?
What casino stakes allow for the worst session to be completed?
What casino stakes allow for the average session to be completed?
Can you successfully win 10 times your minimum wager within the stakes?
If so, how much of a bankroll was necessary to achieve it and how many rolls did it take?
I'm recording each spin and bet as well. While these aren't useful in answering the questions, they'll make for some interesting visualizations. I'll also need to learn how to compile and compare data sets, which is one of the goals of this little project.
I searched for roulette and casino on colourlovers.com and found a few options that I dig.
This is a loose example, but I'm thinking of plotting the rolls like this with the 00 through 36 on the Y axis and the X axis showing spin count and bet amount.
Chartist gets closer to showing it, albeit with the usual range problem which I'll need to solve with d3 instead.
Got a big JSON going and spewing out data. Let's get it on.
I went with the first color scheme, Casino Royale, and began adding some styles. I think this is a good time to learn some flexbox. I want some things vertically centered and I want the sidebar with information to have a different color background. The 2 columns are uneven and can vary as to which one is longer. There are hacks for that in the grid but I'd rather just learn flexbox since this is a side project and I'm not worried about people seeing it or what browser they're in.
I'm doing a weird combination of Middleman math and JS math to get the values. When I do a session, I've started recording them as single unit values. Ultimately, I want to show the results for multiple bet amounts: $25, $50, $100, maybe $200. For now, I got it working at $50 and I'll work out how to make it more flexible when I'm ready.
The beautiful thing about working with existing data to create the designs is that the data dictates the needs. Before collecting and organizing, I imagined that a scatter chart showing all of the numbers would be interesting. While it may look interesting visually, it doesn't have much impact on the proofing that I'm doing. In this case, I really don't care about what numbers are there. I only care what category they are in, with categories being an available even-money bet type: 1-18, 19-36, odd, even, black, red. I'm not recording this information, but that's just because it's so much more effort and leaves room for error. I'll be using Middleman for this, comparing the individual number against a set of numbers. I'll get a rough version working with template logic and then bug Drew for how to write it better.
Streaks are another thing of interest. They are the best or the worst thing that can happen to a session. A streak of wins is good, a streak of losses is bad. Right now, I can't get these at all. I'll need the results of the checks on the numbers to then identify streaks. Not sure how that will happen yet, but I'll work it out once I can see them.
I have this data, but I don't know how to extract certain bits out of it. These things are easily done manually, but I want to do them programmatically. I want to be able to programmatically show what category of bet a spin number is and then graph the results of those.
At this moment, I can't achieve that even with data that I do have recorded. In a session, I want to divide the numbers into their bet categories and graph opposing categories: Red vs. Black, Even vs. Odd, 1-18 vs. 19-36. I can create a table with some really complex if statements, but thinking that this may be a scenario where I have to combine Middleman and d3.
You can see the results and the streaks here, but I also want them in graphs. This is a start, though, so I'm going to put these in. Visually, the check and the 'x' aren't big enough to follow cleanly so I'll do them in a different way.
Seeing this in action, I think it's something that I'll want to keep (in addition to visualizing the percentages. It's really interesting and important to betting to see the streaks. Identifying long streaks allows to show how bad it couldn't have gotten in any one session.
jQuery length will get me a lot of what I want so I'll probably start with that. Now that all of this stuff exists in the DOM I can loop over it pretty easily. One quick example is the number of times a number was 1-18 occurred in the first set. I chose this one because it's insanely low.
As usual, getting the data in helped make decisions. Once I could see the percentages I realized that they're not as important. They'll make for a good graph (maybe a donut chart), but seeing the spin counts make things more apparent. It's awesome to see 009, which was a perfect session.
I've had this in a spreadsheet for reference but I'd rather have it here since I can see the streaks visually now.
Drew fixed my two problems in minutes, like usual. For the ternary operator on classes, I just wasn't supposed to keep the word "if".
The comparisons are a bit more complicated. I need to set up a JSON with an array to compare to. It makes total sense, but I wouldn't have thought to do it on my own.
Changing up one small thing and one significant thing. I'm going to display the sessions in reverse order. When I add a new one it's silly to have to scroll past them all. The bigger thing is longer sessions.
In 15 sessions, the biggest bet was $6,400. While that was the last bet before disqualfying the MGM limits, there was one additional bet left for each of the others. It's time to push the system for some sessions to see where it breaks.
It didn't affect the session outcome because I was betting a new bet every time in rotation, but it had a 9 loss streak that would have made it impossible to bet the necessary amount at any of the casinos. With 9 losses, you need to be able to bet $25,600 but the most lenient allows for $20,000.
With a $20k cap, you'd have $45,550 invested and would win $40,000. The cap causes a $5,550 loss.
With a $10k cap, you'd have $22,750 invested and would win $20,000. The cap causes a $2,750 loss.
With a $15k cap, you'd have $40,550 invested and would win $30,000. The cap causes a $10,550 loss.
Imagine if you lost the max bet!
The $15k is clearly the worst loss, but you get to last one extra loss in that and the $20k. 8 losses in a row guarantees a financial loss at a $10k cap, 9 losses guarantees a financial loss at $15k and $20k caps.
The purpose was to determine if it was possible to achieve a small number of wins before hitting a point in which the betting caps would force a loss. It's a small sample, but it is. In 20 sessions, the profit was $11,250. At this point, hitting the max bet but winning would still result in a profit. Hitting a the max bet is a whole other level of hurt.
More importantly, I'm now fascinated with other things in the numbers and I want to revamp what I'm showing. For one, I need 0 and 00 in the data. I'm comparing percentages of rolls incorrectly without them. Additionally, every time a set is completed there are 2 other winning sets. These can be compared as well to indicate how the bet decisions affected the outcome. Basically, there's a lot more data to dive into and it'll requre a new design. I really want to keep this version, though, to show what I learend. This is v1, onto v2.