Option Explicit
Sub jikken()
Dim i As Integer, j As Integer, k As Integer, l As Integer, m As Integer, n As Integer
Dim c As Integer
Dim o As Long
For o = 1 To 10
For i = 1 To 50
For j = 1 To 50
Randomize
c = Int(2 * Rnd)
If c = 0 Then
Cells(i, j).Interior.Color = RGB(255, 255, 255)
Else
Cells(i, j).Interior.Color = RGB(0, 0, 0)
End If
Next j
Next i
For k = 2 To 49
For l = 1 To 50
If Cells(k - 1, l).Interior.Color = Cells(k + 1, l).Interior.Color Then
Cells(k, l).Interior.Color = Cells(k - 1, l).Interior.Color
End If
Next l
Next k
For n = 2 To 49
For m = 1 To 50
If Cells(m, n - 1).Interior.Color = Cells(m, n + 1).Interior.Color Then
Cells(m, n).Interior.Color = Cells(m, n - 1).Interior.Color
End If
Next m
Next n
Next o
End Sub
1 プログラム 以前のプログラムを修正したのでここにメモ。 ・ランダムに生成され、オセロ的に収束する空間。: https://tanakah17191928.blogspot.com/2025/08/blog-post_8.html Option Explicit Sub jikken() Dim i As Integer, j As Integer, k As Integer, l As Integer Dim c As Integer Dim o As Long For o = 1 To 10 For i = 1 To 50 For j = 1 To 50 Randomize c = Int(2 * Rnd) Cells(i, j) = c If c = 0 Then Cells(i, j).Interior.Color = RGB(255, 255, 255) Else Cells(i, j).Interior.Color = RGB(0, 0, 0) End If Next j Next i For k = 2 To 49 For l = 2 To 49 c = Int((Cells(k, l) + Cells(k - 1, l) + Cells(k + 1, l) + Cells(k, l - 1) + Cells(k, l + 1)) / 5 + 0.5) Cells(k, l) = c If c = 0 Then Cells(k, l).Interior.Color = RGB(255, 255, 255) Else C...