Monday, February 23, 2015

Domain Language: The Playthrough Bonus

Since online gambling has been regulated in Belgium, basically each eligible license holder has complemented their land based operations with an online counterpart. Being such a small country, everyone wants to secure their market share as soon as possible. The big players have been pouring tons of money in to marketing and advertising, it's everywhere: radio, television, (online) newspapers, bus stops, billboards, sport events, airplane vouchers - you name it. While regulations for land based casinos are very strict and almost overprotective, regulations for online play are much more permissive. This makes that online casinos can be rather aggressive acquiring new customers.

You will often see online casinos hand out free registration bonuses: "You get 10 euro for free when you sign up, no strings attached!". This makes it look like casinos are just handing out free cash right? We should all know better than that though.

There are always conditions to cash out a bonus. Bonuses come in different forms and flavors and preconditions to clear them vary wildly. The Playthrough Bonus is the favorite among players by far; it's straightforward and requires zero investment.

When you receive a Playthrough Bonus, you receive an amount of bonus money, which can be converted to cash by wagering it a specific amount of times. For example; you receive a Playthrough Bonus of 10 euro, which needs to be wagered 30 times before the bonus is cleared. This means that you need to bet 300 euro (10 euro multiplied by 30) in total to clear the bonus and to receive what's left off your balance.

So is betting the bonus amount 30 times realistic, or will you always close your browser empty handed with nothing to show for on your balance? The answer depends heavily on the payout rate. This percentage represents how much of the money that goes into the casino, is returned to players. In a formula, this is the wins divided by the bets. This percentage is generally a lot higher than most people expect. Casinos aim for a payout rate between 95 and 99 percent. They want to cultivate a long term relationship with happy and social customers, not clear your bank account as soon as you open the door. Note that the payout percentage is an average, not all games are a smooth ride. Some players like big wins, and big losses, while others feel more comfortable losing small, but don't mind winning small either. Casinos also prefer a smooth ride, especially when it comes to bonuses. They might even tweak games to have less aggressive, more equally distributed wins when bonus money is in play.

Now let's look at how much money would be left on our balance when we try to clear a Playthrough Bonus of 10 euro with a playthrough of 30 and a payout percentage of 98.

I defined two records (excuse my primitive obsession). First a Bonus record that contains an amount, a balance, the total amount of bets and a playthrough. A few functions are associated with the Bonus record; they allow the bonus to be created, to bet, to win, to check if it still accepts bets and to check if the bonus has been cleared. The second record, the GameSettings, define the payout percentage and the stake of a bet.

After defining these structures, I defined a function that recursively keeps playing (bet and win) until either the bonus is cleared, or the bonus no longer accepts bets (out of money).

When we run this function we know the answer to our question. On average, we will clear the bonus with four euro left on our balance.

When we turn down the payout to be one percent lower, we only have 1 euro left on our balance. When we turn it down even more, there won't be anything left.

Given a few parameters which should be available to you (bonus amount, playthrough and even payout percentage), you can calculate how feasible it is to clear a Playthrough Bonus. Unless variance is on your side, I guess it will rarely turn out to be a lucrative grind.

Sunday, February 15, 2015

Side by side

This week marked my first year at my current employer. While that event went by rather silently, one year in, a few of my observations are finally shaping up to be cast into writing.

Where I used to work in the typical battery cage, I'm now part of a team of just four people, having the luxury of a big dedicated room to ourselves - a whole floor actually. The room is set up almost symmetrically; two desks on one side of the room and two more on the other side, with quite some space in between. Having only four people in the room makes it easy to casually throw something at the group - be it a question, a critique or a random idea.

I made good use of this perk early on, but noticed that I would too often find myself amid a Mexican Standoff. We would often get ourselves into discussions that quickly turned into a my-opinion-versus-your-opinion and would lead nowhere.

It didn't make sense how I got myself into this situation time after time, until I read somewhere how to approach petting an unfamiliar dog.
Our species have more in common than you would think. Our shared history of pack hunting has made both our species highly social and interdependent.
For example, when you approach an unfamiliar dog, you shouldn't pet him on the head since this can be very threatening. It's better to approach him from the side to rub his ears, neck or back. This behaviour is an evolutionary remnant of pack hunting; members of the pack would rub each other's shoulder constantly chasing their next meal.

It occurred to me that the cause of our unproductive discussions might be as simple as our desks being in an aggressive position, desk-to-desk or face-to-face.
Looking back at my previous jobs, I found no precedents of having discussions in this position. The horrors of the open plan had always forced me to either walk over or to find a meeting room.

But when I look at my personal relationships and discussions, I find more situations that confirm this theory. When going for drinks, most of my friends prefer a noisy and crowded bar, which force you side-by-side just to make yourself understood. Even when communicating with my girlfriend, it's not the cliché tete-a-tete dinner dates that yield the best conversations, it's taking a walk, long road trips or even cooking together.

When it came to avoiding these unproductive situations at work, I now carefully consider which things I can just throw out there, or which things require a side-by-side approach. Even when you got yourself in trouble face-to-face, you can still guide things into a more constructive direction by changing the situation.

Getting side-by-side shouldn't be too hard in a professional environment. Both pair programming and whiteboard sessions (or one of its more exotic evolutions - model storming, mob programming etc) are ingrained in most places now.

Evolution has wired our brain in a way that makes being side-by-side, preferably chasing the same goal, extremely amicable. Although we're no longer hunting for food, we still find ourselves chasing different means of prosperity and success. Just like before, it's still the case that we're at our best as a team, side-by-side, in pack.

Sunday, January 18, 2015

Averages are not good enough (F#)

Let's (no pun intended) look at a set of response times of a web service.

People like having a single number to summarize a piece of data. The average is the most popular candidate. The average is calculated by dividing the sum of the input elements by the number of input elements.

The average is a measure of centre which is fragile to outliers; one or two odd irregular values might skew the outcome. The median on the other hand is always representative of the centre, not just when the data distribution is symmetric. The median is determined by sorting the input elements and picking the one in the middle.

Both measures are terrible at showing how the data is distributed though. The average and median response time might look fair, but maybe there are a few outliers which are giving a few customers a bad time.

Instead of reducing our input down to a single number, it might be better to extract a table that displays the frequency of various outcomes in the input.

Now this is more useful; we can clearly see that the data is not distributed equally and there are a few outliers in our response times we need to investigate further.

This table takes up quite a bit of ink though. What if we want to get rid of the table, but maintain a feel for the distribution of the data?

The standard deviation measures the amount of variation from the average. A low standard deviation means that the data points are very close to the mean. A high standard deviation indicates that the data points are spread out over a large range of values.
It is calculated by taking the square root of the average of the squared differences of the values from their average value.

The standard deviation is even more useful when you put the average at the centre of a graph, lay out the input elements according their deviation of the average and see a bell graph drawn. This means that we can use the empirical 68-95-99.7 rule to get a feel of how the data is distributed.
In statistics, the so-called 68–95–99.7 rule is a shorthand used to remember the percentage of values that lie within in a band around the mean in a normal distribution with a width of one, two and three standard deviations, respectively; more accurately, 68.27%, 95.45% and 99.73% of the values lie within one, two and three standard deviations of the mean, respectively. 

For our set of response times, this means that 68.27% of the response times lies within the 24.8 and 66.4 range, 95.45% lies within the 4 and 87.2 range, while 99.73% lies within the -16.8 and 108 range.

When we calculate the standard deviation, we can put one extra number next to the average and derive from just two numbers how the data is distributed.

In conclusion, the mean and the median hide outliers. Looking at the frequency distribution gives you a more complete picture. If we insist on having less data to look at, the standard deviation and the 68–95–99.7 rule can compress the same complete picture into just two numbers.