1. 11
  1. 6

    I was pretty sure I have seen this in sed(1) already, but I couldn’t find it anywhere, so I’ve been nerd-sniped into doing it myself:

    :b
    p
    s/$/0/
    s/^/,0/
    :a
    s/,\(.\)\(.\)\(.\)/\1\2\3,\2\3/
    s/111,/o,/
    s/110,/o,/
    s/101,/o,/
    s/100,/x,/
    s/011,/x,/
    s/010,/x,/
    s/001,/x,/
    s/000,/o,/
    t a
    s/,.*//
    y/xo/10/
    t b
    

    Example run:

    % echo 00000000000000000000000100000000000000000000000 |sed -f rule30.sed |head -20 | tr '01' ' #' 
                           #                       
                          ###                      
                         ##  #                     
                        ## ####                    
                       ##  #   #                   
                      ## #### ###                  
                     ##  #    #  #                 
                    ## ####  ######                
                   ##  #   ###     #               
                  ## #### ##  #   ###              
                 ##  #    # #### ##  #             
                ## ####  ## #    # ####            
               ##  #   ###  ##  ## #   #           
              ## #### ##  ### ###  ## ###          
             ##  #    # ###   #  ###  #  #         
            ## ####  ## #  # #####  #######        
           ##  #   ###  #### #    ###      #       
          ## #### ##  ###    ##  ##  #    ###      
         ##  #    # ###  #  ## ### ####  ##  #     
        ## ####  ## #  ######  #   #   ### ####    
    
    1. 1

      Awesome 👏