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)
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
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

Possibly Related Threads…
Thread Author Replies Views Last Post
  Game of life Unseen Machine 18 1,055 01-09-2026, 03:45 PM
Last Post: ahenry3068
  Simple text pixel data to array demo Unseen Machine 5 680 09-12-2025, 05:30 PM
Last Post: bplus
  Game of Life again but by way of Parallelism bplus 2 956 02-25-2024, 07:46 AM
Last Post: Pete
  3D rendering of Game of Life by ubi44 bplus 3 1,301 02-16-2024, 02:50 AM
Last Post: bplus
  Pixel Collision apps bplus 9 1,882 03-16-2023, 08:28 AM
Last Post: aurel

Forum Jump:


Users browsing this thread: 1 Guest(s)