【3D(4方向)】パチンコ玉に細工がしてある場合。
1 【3D】パチンコ玉と釘の確率・統計
以前、上からパチンコ玉を落とすゲームを3次元空間でシミュレーションしてみた。・【3D】パチンコ玉と釘の確率・統計。:https://tanakah17191928.blogspot.com/2024/11/3d.html
今回はそれぞれ25%の確率で4方向(前後左右)にパチンコ玉がはじかれるプログラムを修正して、パチンコ玉に細工がしてある場合をシミュレーションしてみる。
・ パチンコ玉に細工がしてある場合。:https://tanakah17191928.blogspot.com/2024/11/blog-post_95.html
2 右(若しくは左)又は前(若しくは後)にはじかれた後は、次も右(若しくは左)又は前(若しくは後)にはじかれやすくなる場合
Option Explicit
Sub game()
Dim i As Long, j As Long
Dim p_x As Integer, p_y As Integer, c As Integer, k_x As Integer, k_y As Integer
For i = 1 To 1000
p_x = 0
p_y = 0
k_x = 0
k_y = 0
For j = 1 To 50
c = 0
Randomize
c = Int(100 * Rnd + 1)
If c <= (25 + k_x) Then
p_x = p_x + 1
If k_x < 25 Then
k_x = k_x + 5
If k_x > 25 Then
k_x = 25
End If
End If
ElseIf (25 + k_x) < c And c <= 50 Then
p_x = p_x - 1
If k_x > -25 Then
k_x = k_x - 5
If k_x < -25 Then
k_x = -25
End If
End If
ElseIf 50 < c And c <= (75 + k_y) Then
p_y = p_y + 1
If k_y < 25 Then
k_y = k_y + 5
If k_y > 25 Then
k_y = 25
End If
End If
Else
p_y = p_y - 1
If k_y > -25 Then
k_y = k_y - 5
If k_y < -25 Then
k_y = -25
End If
End If
End If
Next j
Cells(i, 1) = p_x
Cells(i, 2) = p_y
Next i
End Sub
(1)確率が0%増加する場合
(2)確率が1%増加する場合
3 右(若しくは左)又は前(若しくは後)にはじかれた後は、次も右(若しくは左)又は前(若しくは後)にはじかれやすくなるけれど、一度別方向にはじかれると確率がリセットされる場合
Option Explicit
Sub game()
Dim i As Long, j As Long
Dim p_x As Integer, p_y As Integer, c As Integer, k_x As Integer, k_y As Integer
Dim r As Boolean, l As Boolean, f As Boolean, b As Boolean
For i = 1 To 1000
p_x = 0
p_y = 0
k_x = 0
k_y = 0
r = False
l = False
f = False
b = False
For j = 1 To 50
c = 0
Randomize
c = Int(100 * Rnd + 1)
If c <= (25 + k_x) Then
p_x = p_x + 1
If r = True Then
If k_x < 25 Then
k_x = k_x + 20
If k_x > 25 Then
k_x = 25
End If
End If
Else
k_x = 0
End If
r = True
l = False
f = False
b = False
ElseIf (25 + k_x) < c And c <= 50 Then
p_x = p_x - 1
If l = True Then
If k_x > -25 Then
k_x = k_x - 20
If k_x < -25 Then
k_x = -25
End If
End If
Else
k_x = 0
End If
r = False
l = True
f = False
b = False
ElseIf 50 < c And c <= (75 + k_y) Then
p_y = p_y + 1
If f = True Then
If k_y < 25 Then
k_y = k_y + 20
If k_y > 25 Then
k_y = 25
End If
End If
Else
k_y = 0
End If
r = False
l = False
f = True
b = False
Else
p_y = p_y - 1
If b = True Then
If k_y > -25 Then
k_y = k_y - 20
If k_y < -25 Then
k_y = -25
End If
End If
Else
k_y = 0
End If
r = False
l = False
f = False
b = True
End If
Next j
Cells(i, 1) = p_x
Cells(i, 2) = p_y
Next i
End Sub
(1)確率が1%増加する場合
・パチンコ玉と釘の確率・統計(まとめ記事)に戻る。







