Friday, August 30, 2013

Extreme Rock, Paper, Scissors

Few games have captured the hearts and minds of the public as Rock, Paper, Scissors.

Ok, that's maybe not even remotely true. RPS is one of the most basic games on earth that, barring any possible psychological factors, is essentially a glorified coin toss. That hasn't stopped fantastic organizations like the World RPS Society from existing (their 'responsibility code' includes a recommendation not to use Rock Paper Scissors for life-threatening decisions. Good call.), and some people certainly take the game very seriously.

I'm also going to take it very seriously, albeit in a completely different direction. I came across a post on my new favorite blog last week, DataGenetics, where the author created and examined a sort of iterative 'team-based' game of RPS. In his game, people in a group would be assigned to always play a certain play, and then are drawn into random pairings for a show-down. The winners go back into the pool, and the losers get eliminated, until only one 'team' of players remains.

This becomes an interesting examination that, in a way, can sort of approximate population dynamics. If we had an island where wild rocks, papers, and scissors ran around in their natural habitat, where the natural prey of rocks were scissors (they'd viciously bend the blades before eating them), the natural prey of scissors were paper (the blades would tear into the paper velociraptor-style) , and the natural prey of paper was rocks (who would get... covered? By far the lamest of the RPS triad), then if the populations were fairly equal the island would stay at a fairly steady equilibrium. As soon as you remove, say, scissors, the rock population would be catastrophically destroyed by all the unchecked paper roaming around... covering them.

Alright, so it isn't a perfect analogy, but I hope you get the point. As this is a non-transitive food cycle (instead of a mostly transitive food chain), the dynamics are a little bit different than what you might expect in real life, but population dynamics in simple predator-prey models really are rather fascinating.

DataGenetics' results were really cool, though, so I decided to see if I could reproduce them and take them further. The first model he made featured 10 rock players, 10 paper players, and a varying number of  scissors players. What do you think would happen as the population of starting scissors players decreases? Surprisingly, their odds of winning actually increase. In fact, as long as there is at least one scissors player, their odds of winning the whole thing range from 33% to 60%, with a peak when the starting scenario is 10 rock, 10 paper, and 4 scissors.



My results came from running 10,000 game simulations per data point, and almost perfectly match up with the results from DataGenetics, so I'm reasonably confident in them.

What's going on here is actually really cool. Reducing the number of scissors at the outset means that initial pairings between players are going to more likely be between rocks and paper - which paper will (illogically by laying on the rock) win. As the game progresses, it is more likely to become mostly paper and scissors, which is an easy scenario for the scissors to win. This means that unless scissors get unlucky and have a lot of early pairings against rocks, they have much better than even odds of winning the game outright. As DataGenetics put it, this is a great example of the expression "The enemy of my enemy is my friend."

Here's a cool alternative view:


If you run a similar scenario, but with 50 rocks, 50 papers, and a variable number of scissors, the results are even more extreme - scissors' best chance of winning is when they start with 17 players against their opponents' 50 each, where they have a 91% chance of winning the whole game.


The reversal of the trend between rocks and scissors here is also pretty fascinating. At larger numbers of initial players, paper's odds of winning are much more sensitive to changes in the number of scissors than rock's, until the number of scissors becomes drastically low. It's also worth pointing out that my results here deviate a bit form DataGenetics after 25 scissors players, even though I was trying to do fundamentally the same thing as he was. I have no idea who's correct, so I guess it's time for a nerd show-down...

I said I was going to take this a step further, and the nerdiest way of taking Rock, Paper, Scissors further is to change it to Rock, Paper, Scissors, Lizard, Spock.

 
Good thing the rules to normal RPS are easy, because adding two new options adds seven new combinations to remember. As the Big Bang Theory puts it:
 
  • Scissors cut paper,
  • Paper covers rock,
  • Rock crushes lizard,
  • Lizard poisons Spock,
  • Spock smashes scissors,
  • Scissors decapitates lizard,
  • Lizard eats paper,
  • Paper disproves Spock,
  • Spock vaporizes rock, and (as it always has)
  • Rock breaks scissors


  • So what if we ran the same game experiment, but with 10 each of the five combinations? If we kept scissors as the changing variable to be consistent, we get the following:



    Now this is just cool. Instead of scissors getting a bonus by losing players from the start, scissors are barely affected at all until their numbers get small enough. While the starting number of scissors is between 4-10, they're still doing about average with 20% chance of winning, after which their chances plummet.

    What's far more fascinating is the other players - poor Spock gets mutilated! Spock's chances of winning are always less than scissors' until scissors has 0 starting players. Why?

    Most likely it's because, even though Spock smashes scissors, scissors is the only player that can kill both of Spock's predators (lizard and paper). As the chances of both of these getting killed decrease, so too does Spock's chances of winning the game. Meanwhile, lizard is having a great time. Its one big predator, scissors, is dwindling in numbers, meaning it more likely will have to face paper or Spock, which it's of course fine with.

    If we bump up the number of starting players to 50 again, we see the true dominance of rock, and again scissors tends to suffer very little (in fact, they're second-most likely to win up until they start off with only 20).

     
    Very cool indeed, especially if you're rock. Again, poor Spock gets decimated, but in general the behaviors of the other players are largely similar to the previous example, but at a much reduced scale to give way to rock.

    In reality there's virtually no practical application to any of this, except to perhaps point out the unanticipated consequences that may arise when you remove an element of a balanced ecosystem. Population dynamics in the wild certainly don't follow such simple rules, but it's definitely not unheard-of for the addition or removal of a small part of the population of a species to have massive ramifications on other species, and the fact that this can be modeled with math and Rock, Paper, Scissors is pretty cool.

    1 comment:

    Civatrix said...

    Rock's clearly require a steady supply of something (be it air, light, etc.) and paper smothers them to death. It would be like a species of plastic bags killing humans, doesn't make sense at first until you watch a bag drop from a tree and smother the human in 45 seconds flat.