Showing posts with label games. Show all posts
Showing posts with label games. Show all posts

Thursday, May 1, 2008

So this is what my Degree comes to...

After many years of study, it comes down to solving logarithms in your head while you're trying to get to sleep.

How many rounds of Russian Roulette does it take before you have 50-50 or worse odds of surviving?

If we assume there is 1 bullet in a 6 chambered revolver, you have a 1/5 chance of having your wig pushed back, and 5/6 chance of taking another breath. The problem is that every time you play (and survive to play again), you're taking another trial with 5/6 odds, which gives you (5/6)^n probability of surviving after n rounds.

Problem is that when you multiply a number less than 1, you always get something smaller than what you started with. That means one day, you will bite the bullet. The question is, after how many tries?

We wish to solve the following for n:


(5/6)^n = 1/2
=> lg (5/6)^n = lg (1/2)
=> n * lg (5/6) = lg (1/2)
=> n * (lg(5) - lg(6)) = lg(1) - lg(2)
=> n * (lg(5) - lg(2) - lg(3)) = -1


Now here we reason that since lg() is a continuous, monotonically increasing function, by the intermediate value theorem:


2 < 3 < 4 < 5
=> lg(2) < lg(3) < lg(4) < lg(5)
= 1 < lg(3) < 2 < lg(5)


That gives us a tight enough bound for lg(3) ~ 1.5, considering the precision we need only to the nearest whole number, but the bound on lg(5) is pretty loose, so we'll need to do better.

We know that we can approximate an analytic function, as lg() certainly is, about a point "a" using its derivative:


lg(x) ~ lg(a) + lg'(x) * (x-a)


We also know that
 
lg'(x) = 1/(x * ln2)

where e ~ 2.7, so we take ln2 ~ 1.

Together this gives:

lg(5)
~ lg(4) + 1/5 * (5-4)
= 2 + 1.5 = 2.2


Going back to the original equation:

n * (lg(5) - lg(2) - lg(3)) = -1
=> n * (2.2 - 1 - 1.5) = -1
=> n = 1 / 0.3 = 3.3


Lets verify that we haven't wandered completely off-base by checking our calculation:

(5/6)^3 = 125 / 216 > 125 / 250 = 1/2
=> (5/6)^3 > 1/2

(5/6)^4 = (125 * 5) / (216 * 6) = 625 / 1296 < 1250 = 1/2
=> (5/6)^4 < 1/2


So there you have it: 3 rounds of everyone's favorite pastime gives you better than 50-50 odds, and 4 rounds give you worse than 50-50 odds. Running it through the calculator the next morning, you have a 57% chance of surviving 3 rounds, and 48% after 4.

Now, play a game of Russian Roulette and have a blast.

Wednesday, November 7, 2007

A Toy Virtual World Game

I invented a toy-game for thinking about virtual worlds, since attempting to think or discuss a complex system like SL is just too difficult due to so many variables. The idea is to boil down an SL-like VW to the smallest possible subset that still exhibits the same scaling properties of the current SL region server.

Its a game called Boxes and Balls

There are 2 entities in the world: human controlled avatar Balls, and game artifact Boxes.
They both have two forms of state: position of their center in the world, and color.
All balls and boxes all have uniform size.

Humans can freely choose any unique color for their ball to begin with, but the color remains constant for the life of the ball avatar.
Each box can have variable color depending on world conditions.

The world itself is an infinite plane to which the player can move about; however the player is restricted to motion on the plane.

Balls have these actions available to them:
1. move at a uniform rate
2. create a new box that is the same color as itself
3. eat an existing box that is the same color as itself
4. paint any box the to be the same color as itself

The rules that apply in the world are:
1. when a ball collides with another ball, or a box of another color, their motion is halted
2. when a ball collides with a box of its color, it can pass through it
3. created boxes have the same center-position as its creator, at the moment of creation
4. to eat a box, the ball's center must be within the boundary of the box
5. each ball has an Effective Radius, outside of which nothing can be seen or painted

The requirements of the game design:
1. that the game is experienced uniformly by all players -- all players will agree on a consistent interpretation of the game state
2. that the game is scalable to 2M concurrent users

The way in which this models the tough parts of a VW is the way in which any player can affect the state of any other player's physical world within the effective radius.

The way in which this doesn't model the tough parts of a SL-like VW is there is no scripting.