Sign in to follow this  

Shark Attack! Statistics/odds/prizes

Recommended Posts

Imagine you are playing a minigame for MUD called Shark Attack!  (strictly a text-based game)

There are 10 sets of waves (called tides), and each tide has 10 waves. Within each tide there will always be a shark which appears at random in one of those ten waves. 

At the beginning of each tide, the player rolls a single 10-sided dice. At the end of each tide, the player will roll another dice to try and match the shark in the next tide. The object is for the player's dice roll to match the wave which contains the shark. If the player "wins" a tide because their dice roll matches the wave where a shark appeared, they gain 1 in their score. At the end of 10 tides their score is totaled. For each point they have won, they get to roll a single 10 sided dice, and the result of their roll will determine what bag number they win. 

Now the big issue is the prize rewards. The money system is in gold pieces. For the game, 1 million gold in currency is a pretty standard amount and common to have. Imagine there are 10 bags, ranked from least to greatest (1 being least and 10 being greatest. Let's pretend a buy-in amount for a player to play a whole game (10 tides with 10 waves each tide) is 500,000 gold.

For the bag prize amounts, consider maybe:

bag 1 100,000 gold
bag 2 300,000 gold
bag 3 500,000 gold
bag 4 600,000 gold
bag 5 700,000 gold
bag 6 800,000 gold
bag 7 900,000 gold 
bag 8 1 million gold
bag 9 2.5 million gold
bag 10 5 million gold

Since I know very little about statistics/gambling, do those prize amounts seem fair to both the player and dealer? From what I can tell, the player always has 1/10 chance of getting the correct wave that contains a shark. Beyond that, there's a few things I cannot quite understand. Are those prize amounts fair? What are the odds of a player hitting the bat #10 with 5 million gold when they roll? Is there a better way to handle the prizes, for example..different amounts for prizes that makes it equally fair to the dealer and the player?

Share this post


Link to post
Share on other sites
Is that a totally random procedure? I refuse to call it "game" if the player doesn't make any decisions, and as far as I can tell that's the case here.

How about trying to run it by hand a few times? If that's too boring, you probably should rethink your design. If that's OK, write a program that simulates the whole thing and run it a few million times.

EDIT: If you are interested in the math behind this, look up the binomial distribution. Edited by Álvaro

Share this post


Link to post
Share on other sites
Here's how you compute the expected prize for your given table:

#include <iostream>
#include <vector>

double prizes[11] = {
  0,
  100000,
  300000,
  500000,
  600000,
  700000,
  800000,
  900000,
  1000000,
  2500000,
  5000000
};
  
int main() {
  std::vector<double> P(11,0.0);
  P[0] = 1.0;
  for (int tide = 0; tide < 10; ++tide) {
    for (int k = tide + 1; k >= 0; --k)
      P[k] = P[k-1] * 0.1 + P[k] * 0.9;
  }

  double expected_prize = 0.0;
  
  for (int bag = 0; bag <= 10; ++bag)
    expected_prize += P[bag] * prizes[bag];

  std::cout << "The expected prize is " << expected_prize << ".\n";
}


The expected prize is 133409.

[Disclaimer: I wrote this in 5 minutes and didn't check it much, but I've written this kind of code before many times.]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this