【3色・再再再再修正版】ランダムに生成され、オセロ的に収束する空間。
1 プログラム
プログラムを再再再修正しました。・【3色・再再再修正版】ランダムに生成され、オセロ的に収束する空間。:https://tanakah17191928.blogspot.com/2025/08/blog-post_41.html
Option Explicit Sub jikken() Dim i As Integer, j As Integer, k As Integer, l As Integer Dim c As Integer Dim d As Double Dim o As Long For i = 1 To 50 For j = 1 To 50 Randomize c = Int(3 * Rnd) Cells(i, j) = c If c = 0 Then Cells(i, j).Interior.Color = RGB(255, 255, 0) ElseIf c = 1 Then Cells(i, j).Interior.Color = RGB(0, 0, 255) Else Cells(i, j).Interior.Color = RGB(255, 0, 0) End If Next j Next i For o = 1 To 30 For k = 2 To 49 For l = 2 To 49 Randomize c = Int(4 * Rnd) d = (Cells(k, l) + Cells(k - 1, l) + Cells(k + 1, l) + Cells(k, l - 1) + Cells(k, l + 1)) / 5 If c <> 0 Then ElseIf d <= 2 / 3 Then Cells(k, l).Interior.Color = RGB(255, 255, 0) ElseIf d < 4 / 3 Then Cells(k, l).Interior.Color = RGB(0, 0, 255) Else Cells(k, l).Interior.Color = RGB(255, 0, 0) End If If Cells(k, l).Interior.Color = RGB(255, 255, 0) Then Cells(k, l) = 0 ElseIf Cells(k, l).Interior.Color = RGB(0, 0, 255) Then Cells(k, l) = 1 Else Cells(k, l) = 2 End If Next l Next k Next o End Sub
2 実行結果
・【3色・再再再再修正版】ランダムに生成され、オセロ的に収束する空間(東三河狂人堂主人)・ランダムに生成され、オセロ的に収束する空間(まとめ記事)に戻る。