Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pixel life
#8
OK here is another Mutation: Pixel Life 2
Code: (Select All)
Option _Explicit
_Title "pixel Life 2" ' b+ 2023-10-15
' inspired by James Jarvis Pixel Life

Dim As Long XPixels, YPixels
XPixels = 401 ' so we can do perfect symmetry
YPixels = 401 ' ditto

Screen _NewImage(XPixels, YPixels, 12) ' the 12 only allows 16 colors
_ScreenMove 400, 150

Dim As Long s2, x, y, xx, yy, nc, gen
s2 = _NewImage(XPixels, YPixels, 12)

Do
    _Dest 0
    _PutImage , s2, 0
    _Display

    ' update s2
    _Source 0
    _Dest s2
    Line (0, 0)-(XPixels - 1, YPixels - 1), 9, B ' draw eternal white border seed and sun!
    Line (1, 1)-(XPixels - 2, YPixels - 2), 0, BF ' clear inside
    For y = 1 To YPixels - 2
        For x = 1 To XPixels - 2
            nc = 0
            For yy = -1 To 1
                For xx = -1 To 1
                    If Point(x + xx, y + yy) Then nc = nc + 1
                Next
            Next
            If Point(x, y) Then nc = nc - 1
            If nc = 2 Then
                PSet (x, y), 9
            ElseIf nc = 3 Then
                PSet (x, y), 10
            End If
        Next
    Next
    gen = gen + 1
    _Title "Gen:" + Str$(gen)
    If gen < 300 Then _Limit 100 Else _Limit 1
Loop Until _KeyDown(27)
b = b + ...
Reply


Messages In This Thread
Pixel life - by James D Jarvis - 10-15-2023, 04:11 PM
RE: Pixel life - by bplus - 10-15-2023, 04:30 PM
RE: Pixel life - by James D Jarvis - 10-15-2023, 04:51 PM
RE: Pixel life - by bplus - 10-15-2023, 05:00 PM
RE: Pixel life - by James D Jarvis - 10-15-2023, 06:01 PM
RE: Pixel life - by bplus - 10-15-2023, 10:20 PM
RE: Pixel life - by James D Jarvis - 10-15-2023, 10:51 PM
RE: Pixel life - by bplus - 10-16-2023, 12:20 AM
RE: Pixel life - by James D Jarvis - 10-17-2023, 12:25 AM
RE: Pixel life - by James D Jarvis - 10-17-2023, 12:39 AM



Users browsing this thread: 1 Guest(s)