G'MIC fun with Reptorian


Just leaving his here as I like how this turns out.

1 Like

4 Likes

@Reptorian , I must say that I really appreciate your graphic creations. I don’t really understand how you did it with G’MIC, but it’s very nice!

2 Likes

Most of the time post-processing. Though only with changing colors/alpha, and blending modes. At the most, fixing up artifacts though G’MIC is exclusively used for that.

Indeed, as I keep on saying, they getting increasingly compelling. It appears you are fighting less with the code and spending more time on the creative parts (both the coding and generative art).

1 Like

Nearly post-processing (only used Additive Blending Mode using the copied result and very low opacity).


It looks great like this I think.

And I did another Hitomezashi:

3 Likes

Another one:

I really do like how Complexion Burst looks spirit-like.

5 Likes

This engenders a deep and satisfying contemplation, here in the wee hours of a Sunday morning. A nice one Rep.

1 Like

New one!

4 Likes

I added some palettes, and this is the main motivation to do that:

image

2 Likes

Looks like a crossover between Mondrian and my old box of Lego so i like it :wink:

1 Like

Having fun with the new text feature:

Probably the first time I will release a .gmic file for a game modding community. Might be a good way to get more G’MIC coders.

1 Like

I’m doing Advent of Code with G’MIC. Solution to Day 2 with G’MIC:

#@cli advent_of_code_day_2_answer:
#@cli : Code to Day 2 Advent of Code.
advent_of_code:
it game_file
 
split -,{_'\n'}
 
1,$!,1,1,"rounds=1;repeat(h#y,p,if(i[#y,p]==_'\;',++rounds;););rounds;"
resize[-1] {1+3*iM},100%,1,1,0,0 => game_data
 
max_r,max_g,max_b=12,13,14
 
repeat $!-1 {
 rv[-2,-1]
 
 current_game:=$<+1
 
 color_data=""
 local[-1] {
    split -,{_':'} rm[-2]
    crop 0,1,0,100%
    split -,{"'; '"}
 
    foreach {
        split -,{"', '"}
 
        r,g,b=0
        foreach {
            split -,{"' '"} 
 
            number_of_colors={`crop(#-2)`}
            color={`crop(#-1)`}
 
            if '$color'=='red'     r=$number_of_colors
            elif '$color'=='green' g=$number_of_colors
            elif '$color'=='blue'  b=$number_of_colors
            fi
 
            rm
        }
 
        if narg($color_data) color_data.=,$r,$g,$b
        else color_data=$r,$g,$b
        fi
    }
 
    rm
 }
 
 ($color_data)
 image[game_data] [-1],1,$<
 rm.
 
}
 
1,100%,1,2,>"
 v=c?1;
 rf=i(#-1,0,y,0,0);
 crop_start_point=1;
 c?(
    repeat(rf,
        current_crop=crop(#-1,crop_start_point,y,0,0,3,1,1,1);
        if(current_crop[0]>12,v=0;break(););
        if(current_crop[1]>13,v=0;break(););
        if(current_crop[2]>14,v=0;break(););
        crop_start_point+=3;
    );
    v?v+y;
 ):(
    local_max=vector3(0);
    repeat(rf,
        current_crop=crop(#-1,crop_start_point,y,0,0,3,1,1,1);
        local_max=vmax(current_crop,local_max);
        v=prod(local_max);
        crop_start_point+=3;
    );
    v;
 );
 "
 
split c
 
e[^-1] "Sum of Possible Game ID via restriction: "{is#-1}
e[^-1] "Sum of Power of minimum cubes required: "{is#-2}
 
rm
1 Like

I revisited my old brainfuck to test rep_cin command I did. Seems that I had to add wait to make it behave as expected.

rep_cin is the closest one could have to input() in Python or std::cin in C++. There’s almost no use case for this except for building G’MIC applications outside of image processing, but this allows this option.

C:\Users\User\Documents\G'MIC\Brainfuck Interpreter>gmic "brainfuck_interpreter.gmic" run_brainfuck \">,>,<<++++++[>-------->--------<<-]>[>[>+>+<<-]>[<+>-]<<-]>[-]>+>>++++++++++<[->-[>>>]++++++++++<<+[<<<]>>>>]<-<++++++++++>>>[-<<<->>>]<<<<++++++[>++++++++>[++++++++>]<[<]>-]>>[.<<]<[<<]>>.\",1
[gmic]./ Start G'MIC interpreter (v.3.3.3).
[gmic]./ Input custom command file 'brainfuck_interpreter.gmic' (4 new, total: 4806).
[gmic]./ Brainfuck Interpreter Inserted Argument#1: 31
[gmic]./ Brainfuck Interpreter Inserted Argument#2: 3
[gmic]./ Brainfuck Output: 93
[gmic]./ End G'MIC interpreter.
#@cli run_brainfuck_it: brainfuck_file,'_enforce_numbers_input={ 0=false | 1=true },_size_of_array>0
#@cli : Interprets Brainfuck code file within G'MIC brainfuck_interpreter.
#@cli : Default values: ,'_enforce_numbers_input=0','_size_of_array=512'
run_brainfuck_it:
    skip ${2=0},${3=512}
    it $1
    _brainfuck_interpreter $2,$3
    um run_brainfuck_it,run_brainfuck,_brainfuck_interpreter,_brainfuck_interpreter_byte_input
#@cli run_brainfuck: brainfuck_code,'_enforce_numbers_input={ 0=false | 1=true },_size_of_array>0
#@cli : Interprets Brainfuck code within G'MIC brainfuck_interpreter.
#@cli : Default values: ,'_enforce_numbers_input=0','_size_of_array=512'
run_brainfuck:
    skip ${2=0},${3=512}
    ('$1')
    _brainfuck_interpreter $2,$3
    um run_brainfuck_it,run_brainfuck,_brainfuck_interpreter,_brainfuck_interpreter_byte_input
_brainfuck_interpreter:
    # 1. Convert image into dynamic image
    resize 1,{whd#-1},1,1,-1 ({h}) append y # Convert string images into dynamic image
    name[-1] brainfuck_code                 # Name image into brainfuck_code

    # 2. Remove unused characters
    eval "
        for(p=h#-1-2,p>-1,--p,
            char=i[#-1,p];
            if(!(inrange(char,_'+',_'.',1,1)||(find('<>[]',char,0,1)!=-1)),
                da_remove(#-1,p);
            );
        );
        if(!da_size(#-1),
            run('error inval_code');
        );
        da_freeze(#-1);
        "

    # 3. Evaluate brackets
    eval[brainfuck_code] >"
        begin(level=0;);
        i==_'['?++level:
        i==_']'?--level;
        if(level<0,run('error inv_bracks'););
        end(if(level,run('error inv_bracks');););"

    1x2  # Create 2 images of 1x1x1x1. One image is for storing print out characters, and the other is to allow inputs.
    _arg_level=1

    # 4. Create JIT code for executing brainfuck code.
    repeat h#$brainfuck_code {
        idx:=i[#0,$>]

        if $idx==_'+' code_str.=ind_list[ind]++;ind_list[ind]%=256;                             continue fi
        if $idx==_',' code_str.=run('$0_byte_input[-2]\ $1');ind_list[ind]=i(#-2,0,0,0,0)%256;  continue fi
        if $idx==_'-' code_str.=ind_list[ind]--;ind_list[ind]%=256;                             continue fi
        if $idx==_'.' code_str.=da_push(#-1,ind_list[ind]);                                     continue fi
        if $idx==_'<' code_str.=if(!inrange(--ind,0,$2,1,0),run("'error out_of_bound'"););      continue fi
        if $idx==_'>' code_str.=if(!inrange(++ind,0,$2,1,0),run("'error out_of_bound'"););      continue fi
        if $idx==_'[' code_str.=repeat(inf,if(!ind_list[ind],break(););                         continue fi
        if $idx==_']' code_str.=if(!inrange(ind,0,$2,1,0),run("'error out_of_bound'");););               fi
    }

    # 5. Execute created JIT code. v + and v - is used to change verbosity level, not part of JIT execution. e[] is used to print into console.
    v +
    eval >begin(ind=0;ind_list=vector(#$2,0););if(!inrange(ind,0,$2,1,1),run("'error out_of_bound'"););$code_str;end(da_freeze(#-1););
    v -

    # 6. Print out executed code result
    v + e[$^] "Brainfuck Output: "{t} v -
    remove
_brainfuck_interpreter_byte_input:
    repeat inf {
        wait         # For some reason, I had to add this to make this code work!

        if $> rep_cin "Brainfuck Interpreter - Wrong Input! Insert Integer for Argument#"$_arg_level": "
        else  rep_cin "Brainfuck Interpreter - Enter Argument#"$_arg_level" (Integers Only): "
        fi

        if $1 input:=${}+_'0'
        else  input=${}" :: "{`${}`}
        fi

        if isint($input) break fi
    }

    if $1 v + e[$^] "Brainfuck Interpreter Inserted Argument#"$_arg_level": "{$input-_'0'} v -
    else  v + e[$^] "Brainfuck Interpreter Inserted Argument#"$_arg_level": "$input v -
    fi

    _arg_level+=1
    f[-1] $input

I need to upgrade my PC (Created with Graphical Tiling Glitch filter in G’MIC):

Another take:

4 Likes

Haven’t seen this for a long time’
Thank you Linux :wink:

2 Likes

If I am not mistaken, this glitch animation also exists at the end of a card game. FreeCell? Rep, if you up to having fun, perhaps try emulating old Windows and other operating system screensavers like Starfield and 3D pipes.

No, you’re not mistaken, it definitely exists.

There’s a website with downloadable screensaver, and I do have a Win XP virtual machine. So, I can check which ones I’d like. Unfortunately, I am still only refactoring and improving my existing code. No new filters for a very, very long time.

I tried getting this from @thefoldster on X (I’m not linking to that):

r = range(512)
x, y = np.meshgrid(r, r)
i = (1 == (abs(x+y)^abs(x-y)+1)**37 % 7) * 255
Image.fromarray(i).convert('L').save('1.png')

My result:

image

rep_thefoldster_img:
512,512,1,1,"begin(
  modpower(a,b,c)=(
   res=1;
   current_a=a;
   current_b=b;
   
   current_a%=c;
   if(!current_a,res=0;);
   current_a>0?(
    while(current_b,
     if((current_b&1),res=(res*current_a)%c;);
     current_b>>=1;
     current_a=sqr(current_a)%c;
    );
    res;
   );
  );
 );
 1==modpower(xor(abs(x+y),abs(x-y)+1),37,7);
 "
2 Likes

I’ve tried doing it also, and I get something really similar to you:

foo :
  512,512,1,1,"
    powermod(a,b,c) = b?(
      res = 1; base = a%c;
      for (k = b, k>0, k>>=1, (k&1)?(res = (res*base)%c); base = (base^2)%c);
      res
    );
    powermod(1 + xor(abs(x + y),abs(x - y)),37,7)==1"

One thing that I find strange: In the original expression, why using abs(x+y) instead of x+y, if x and y are both positive?
I’m not able to explain the difference between the two approaches at this point.