Friday, August 24, 2007

I Geeked Out on Redbull Roshambull

So what does the Excel_Geek do late at night when he can't sleep, but isn't motivated enough to work on one of the countless other Excel projects he's got on his plate?

He plays rock paper scissors on Redbull Roshambull, a Facebook app created for Redbull by the guys down at Archrival.

Being an Excel_Geek, though, I couldn't just play, right? I had to better understand how strategy comes into play. Now I'm not talking about throw strategy -- that is when to throw rock vs. paper vs. scissors. There are countless strategies you could enact based upon things like an opponents past five matches, or throw by throw tendencies over their history, or overall throw tendency, or the overall throw tendency of the total Roshambull userbase (if you had access to that data, which I do not) or even strategies not based upon tendencies, but on the weather or day of the week or even random. This is not what I concerned myself with.

I have my own throw strategy I've been toying around with, and so far, it's lead me to a fairly consistent 55-59% win rate. (Thank you, thank you.) For this exercise, though, I assumed away a player's overall winning percentage, and actually looked across a range of winning percentages, from 50% to 60%. I didn't concern myself with win rates lower than 50% -- those which we'll call "losers" -- since to me the obvious best strategy for "losers" is to simply give up and not play. ;) Seriously, though, I thought this material would be much more relevant to those who believe they have some ability to beat the 50:50 odds inherent in this game or at least tie them. Maybe some other time I'll look at -- ahem -- solid "loser" strategies for Roshambull...

What I wanted to explore was betting strategy. Say your goal is to amass as many creds as possible. Given that you start with 20 creds (and if you lose all your creds you can start over with another 20) and you can bet as much or little of that as you like -- either directly to your friends or using the Match Finder -- what would be the best strategy for how much you should bet on any given match based upon how much you have and what your overall winning percentage has been? You know what I mean? Is it best to continually put it all on the line or should you pull back after you've gotten so many?

So I decided to look at two betting strategies:

  1. All-In-All-The-Time, which is just like it sounds. It assumes you can always find an opponent to take on at any given level of creds, and you bet it all on every match.
  2. Match-Finder-Only, which assumes you'll only use the Match Finder feature and bet as much as you can for any given cred level. Example: if you had 40 creds, you'd bet 20, since you don't have enough for a 50 cred match yet. This strategy has the built-in characteristic of pulling back once you've amassed so many creds, since you can only go up to 2,500 cred matches.
So I built a model whereby I could simulate up to 100 consecutive matches -- just the win vs. loss, not actual RPS throws. To do this I randomly assigned a value between 1% and 100% to the match that would correspond to either a win or a loss, based upon what the player's assume win rate. Example: a random value of 45% for a player with a 50% win rate would be a win because it was less than or equal to that win rate, where a random value of 76% would be a loss since it is higher. Based upon the cred balance before the match and the betting strategy, a bet amount would be assigned to each match, and based upon the results of the match the cred balance would be adjusted accordingly. Following a completed 100 match streak, I only wanted to know the high cred balance seen during the string. Then I realized that one 100 match string was just that -- one instance -- and I wanted to be a bit more probabilistic, so I wrote a script that ran it through 500 trials of 100 match strings, and calculated the probability of a maximum cred balance at various levels.

You following this?

Now 500 trials is a lot, but much less than infinity, so we're not talking true probabilities here -- I'm no actuarial scientist or even really that good with statistics -- but 500 trials is fun to look at and should give us all a feel, right? Plus, I simulated nearly 3 million matches to get this data, and even with a relatively speedy processor in my laptop, this took almost an hour's worth of processing time!

Here's an example of what the results looked like for the "Match-Finder-Only" strategy, assuming a 57% win rate (in histogram form):

(Click on the image to pop open a new window or tab with a larger version.)

That data breaks down in to the chart below, which shows the likelihood (in that 500 trial experiment) that a player would have ever hit the various maximum cred levels:

(Click on the image to pop open a new window or tab with a larger version.)

Over these 500 trials of 100 match strings, there was a 15.2% chance the player would have amassed more than 10,000 creds using this strategy. Interesting? (If you said or though "Yes" you're probably a geek, too.) Just wait, now we'll look at the corresponding charts for the other "All-In-All-The-Time" strategy:

(Click on the image to pop open a new window or tab with a larger version.)

(Click on the image to pop open a new window or tab with a larger version.)

Interesting now? See how everything has "slid" to the right a bit? Notice how over these 500 trials the player using this strategy has a 26.2% chance of amassing >10,000 creds -- an increase of 11%. Also, notice that now the player has nearly a 1% chance of amassing over 500,000 creds! What this effectively means is that the player has nearly a 1% chance of hitting a 16 match win streak during any given 100 consecutive match period if he or she has a win rate of 57%. Huh... Just the other day I went on a 12 or 13 match streak myself...too bad I wasn't using this betting strategy then.

If we pick one point along these graphs -- say hitting >10,000 creds -- and plot the data for the two strategies' results over multiple assumed win rates, we get something that looks like this:

(Click on the image to pop open a new window or tab with a larger version.)

At every win rate from 50% to 60% the All-In-All-The-Time strategy outperforms (during this 500 trial experiment). Similar results would be seen at other relatively higher points along the "maximum creds amassed" scale. I should also note that while we really didn't see it over this 500 trial experiment, I would expect to see relatively greater volatility for this strategy, given it's propensity for higher and higher wager amounts when long winning streaks do occur.

One other factor that I thought would be interesting (to me at least) is the impact on the number of consecutive matches played on the results. It stands to reason that the more matches you play using the strategy, the more likely it is that you'd see a winning streak that could result in higher maximum creds amassed, so not surprisingly, here's the two strategies over 10, 25, 50, 75, and 100 matches:

(Click on the image to pop open a new window or tab with a larger version.)

(Click on the image to pop open a new window or tab with a larger version.)

You can see how the likelihoods are pretty slim when only playing 10 matches. After all it takes a streak of 10 (all ten would have to be wins) to go over 10,000 creds using the All-In strategy and 13 (impossible with on 10 matches) using the Match-Finder-Only strategy. The likelihoods grow, however, as you move up to 100 matches, and I assume they'd continue to grow and eventually plateau as we moved past 100 matches to 1,000 matches and beyond.

What does this all mean? What am I concluding?

I think I can only conclude that if you want to amass huge numbers of creds in Redbull Roshambull, in order for probability to be on your side you should...
  1. Play as many matches as possible, and
  2. Go all-in all the time, baby!

What have you got to lose?



Tuesday, August 21, 2007

3D XY Scatter Plot Graph

Hey everyone.

I just recently did a quick project for a guy who wanted to visually represent data along three dimensions. All I can say is thank goodness for Andy Pope and his charting wizardry!

By using Andy's "3d XY-Scatter" as a starting point, doing some clever formatting, and adding in some vertical error bars, I think I've accomplished a pretty decent looking 3D "push pin" sort of representation. I even used a little known trick to add transparency to the "heads" of the "pushpins", so that when they're close together, you can still distinguish them. Here's what it looks like:

(Click the image to open up a new tab/window with a larger version.)

Now, it'd be nice to add in the ability for the graph to automatically "resize itself" -- i.e. change the values that create the reference "cage", axes, and actual minimum and maximum X and Y axes values -- based upon the data to be plotted and the rotation of each of the axes. Maybe I'll work on it if someone else wants that. Just too many projects going on at once these days.

Insiders Subscribers, your file is on its way!