# Moon

Play alongside other players while the rocket is headed to the moon.

Moon is a game in which players bet on the crash of a virtual moon. The game starts with a rocket launch, and a moon will rise slowly in the sky. Players place bets on when they think the moon will "crash". The time window for betting opens with the first player's bet. The game is over when the moon crashes, and the players holding their bets win. The longer the moon stays in the sky, the higher the multiplier gets, increasing the potential winnings for players who hold their bets until the crash.

- Multiplier is always in the range [1, 100] and players can pick any multiplier within the range [1.01, 100].
- Let's say player picks X. In an ideal Moon game with no additional house edge the probability of the rocket crashing after reaching to X is

$P(\text{Crash after }X) \approx \frac{1}{X}.$

- Random outcome generation should be so that the above probability holds. For this purpose, multiplier where the rocket crashes is generated using the following formula

$\text{Crash Point} = \frac{10000 - H}{10000 - 100H},$

where H is given by

$H=\frac{\text{Random }\texttt{uint256 } \text{mod } 9901}{100}.$

- For example, the probabilities of a crash happening before and after x2 are

$P(\text{Crash before x2}) \approx 0.5075,\:P(\text{Crash after x2}) \approx 0.4925 .$

- If the random number generated by VRF in modulo 9901 is a multiple of 66, the rocket crashes at 1 instantly. This adds an additional ~1.5% house edge to the game, totaling up to ~3% edge. In this case, the same probabilities above are given by

$P(\text{Crash before x2}) \approx 0.515,\:P(\text{Crash after x2}) \approx 0.485.$

Here's a sample code snippet summarizing how the multipliers are generated:

def getMultiplier():

# Representing VRF's output

random_number = random.randint(0, 2 ** 256 - 1)

# Taking modulo 9901

HH = random_number % 9901

# Additional 1.5% edge

if HH % 66 == 0:

return 1

H = HH / 100

return (10000 - H) / (10000 - 100 * H)

Last modified 1mo ago