Why Care?
A friend of mine was interested in an idea for beating the casino at roulette.
His theory is that if he keeps playing either red or black, but adding to the bet, there is a mathematical certainty of winning at some point.
First spin, go red with $10.
Second spin, go red with $22.
Third spin, go red with $33.
Or something like that.
I told him I could write a program that would tell him the number of consecutive results from 50/50 roulette spins.
This is how we did it:
Tutorial For Launching Simple Algorithm Tools
Learning Algorithmic Technology
At this tutorial’s core, this is an HTML5 tutorial.
HTML5 incorporates HTML and JavaScript together. HTML5 incorporates CSS as well, but this tutorial doesn’t discuss that because design hasn’t been addressed here.
This tutorial takes the watcher on a journey of creating a simple web tool. In it we:
- Start a project using command line interface (CLI) tools
- Write the JavaScript algorithmic logic for the probability
- Write the HTML5 user input form and clickable submit button
- Link the JavaScript algorithm and the HTML5 input to work as a graphic user interface
- Write clear directions for what the tool is used for
- Initialize the project as a git project (version history software)
- Sync our project with a GitHub repository
- Publish the tool using GitHub pages
The tool is now available on the internet to whomever cares to view it. Click here to check it out:
www.ianrobinson.net/roulettespinner
If I were to answer my buddies specific question, this tool need more work. We would need to incorporate the increments of betting in order for us to get a specific plan to beat roulette…. but at the end of the day, this isn’t about beating the casinos. Even if we started beating casinos, the casinos would just kick us out.
The cool thing about this is that it helps us think algorithmically about complex issues. Using computers as tools, we can run massive tests in the blink of an eye. My computer only starts to have slow results (requiring 2-3 seconds) around 100 million spins. Imagine how long it would take to do 100 million spins in real life.
Algorithms are fun.