## Overview

Pachinko 10 million times simulation.

I want to make sure that “Is it easy to hit a machine that rounds a lot without hitting? What is the distribution graph of the number of rounds and hits?”

If there is a 1/319 chance of winning, count the number of times until you get a win, and reset it to zero if you get a win.

Perform this repetition 10 million times and check the rotation speed and hit distribution on the graph.

In addition, we will check the likelihood of winning by simulation and probability theory.

## Video

Japanese【日本語】

English

## Python Program

```
import random
from google.colab import files
maxNum = 1000000000 # How many bet at this simulation
maxBet = 5000 # Max Bet count
checkCount = 200 # Check Hit / 200 count
dayCount = 2000 # 2000 count / day
checkCountDiv = maxBet//checkCount # 25
dayCountDiv = maxNum//dayCount # How many days (1000000000 / 2000)
hitCount = [0] * (maxBet + 1)
hitCheck = [0] * (checkCountDiv) # How many Hit per Check count
betCount = [0] * (checkCountDiv) # How many Bet per Cehck count
dayCheck = [0] * (dayCountDiv)
hit = 0
for num in range(1, maxNum):
hit += 1
betCount[((hit-1)//checkCount)] += 1
count = random.randint(1,319)
if count == 319 or hit == maxBet:
if hit == maxBet:
print('hit Over maxBet')
hitCount[hit] += 1 # How many Hit per Bet Count
hitCheck[((hit-1)//checkCount)] += 1 # How many Hit per Check Count
dayCheck[((num-1)//dayCount)] += 1 # How many Hit per Day
hit = 0
# Output
with open('result1.txt', 'w') as f:
for num in range(1, (maxBet+1)):
f.write(str(num) + "," + str(hitCount[num]) + '\n')
files.download('result1.txt')
with open('result2.txt', 'w') as f:
for num in range(0, checkCountDiv ):
f.write(str(num) + "," + str(hitCheck[num]) + "," + str(betCount[num]) + '\n')
files.download('result2.txt')
dayHit = [0] * 30
for dNum in range(0, 30):
for num in range(0, dayCountDiv ):
if dayCheck[num] == dNum:
dayHit[dNum] += 1
with open('result3.txt', 'w') as f:
for num in range(0, 30):
f.write(str(num) + "," + str(dayHit[num]) + '\n')
files.download('result3.txt')
```

## Document

Japanese【日本語】

English

## Comments