dalten-collective / cgol

The Unlicense
1 stars 0 forks source link

cgol: binary, expansive engine #4

Open rabsef-bicrym opened 1 year ago

rabsef-bicrym commented 1 year ago

Current RLE -> @ub conversion routine:

::  +brun: binary from run
::
++  brun
  ^-  $-([rows @ud] bin)
  |=  [ran=rows x=@ud]
  =|  bun=@ub
  |-
  ?~  ran  bun
  ?@  i.ran
    ::  on newline, pad the row
    =?    bun
        !=(0 (mod (met 0 bun) x))
      (rsh 0^(mod (met 0 bun) x) bun)
    $(ran t.ran)
  %=    $
    ran  t.ran
  ::
      bun  
    (cat 0 (fil 0 +.i.ran ?-(-.i.ran %live 0b1, %dead 0b0)) bun)
  ==

Write an engine that can take, e.g., the classic blinker 3o (0b111) and compute its movement on a stage that is programmatically large enough to encompass any movement (i.e., in this case, 5x5 grid to show all movement and all possible, relevant neighbors to live cells) using only hoon's bit arithmetic and logic functions.

The ultimate goal here is to write a flexible, binary engine for cgol that expands to form a square board to encompass all possible live cells produced by some initial seed formation.

See run length encoding, this