# About Crash

### basics

New games run every 8 seconds. Each moment the counter ticks up, with each tick the chance of the game crashing increase until the game crashes. Players place bets on when they think the game will crash. The longer you stay in the higher the cashout reward. Players set a man payout value before the game begins and can cash out early at any time bu clicking the cashout button.

### Probability and Profit

The house edge is set at 2%. 2% of games will crash at 1.0. The probability of a game crashing at 2.0 is therefore slightly lower at 49.8%. The probability of 3.0 is 33%, 10.0 is 10% and so on.

The profit of a bet is the bet amount multiplied by cashout value minus the bet. So a bet of 100 chips with a cashout value of 2.0, would net a profit of 100 chips. A bet of 100 chips with a cashout value of 10.0 would net a profit of 1,000 chips.

### Creating Randomness

Game values are computed similar to other crash games as a as a series of SHA256 hashes. The initial hash is created from a series of 512 random bytes appended with the seed hash. All games are then a hash value of the previous hash appended with the seed value. This creates a chain of hashes originating from the original 512 random bytes. That chain is played backwards for each game such that you can know all previous game values but not future game values.

### Hashes to Values

A game value is computed from a hash by taking the 52 least significant bits from the hash and dividing it by 2 ^ 52. This gives us a number between 0 and 1. We then take the floor of ((99 / (1 - x)) / 100) as the game value.

In code:

dec = hexdec(substr(hash, -13); x = dec / pow(2, 52);

z = floor(99 / (1 - x));

result = max(1, (z / 100));