Skip to main content
better submission
Source Link
GPS
  • 361
  • 1
  • 6

C (clang), 10089 bytes

char *a,b[10],*i,*o;f(x,y){*b=*a;for(x=1;x<8;b[x]=a[y=indexx=1;x<8;b[x++]=a[y=index(i,o[x])-i],b[x+1]=a[y+1],x+=2);puts(bb[x++]=a[y+1]);} 

Try it online!Try it online!

Takes input value in a, in format in i and out format in o. Returns out value in b

Minor cheat: storing result in b instead of printing to save bytes. Question doesn't disallow it.

# [C (clang)], 100 bytes
char *a,b[10],*i,*o;f(x,y){*b=*a;for(x=1;x<8;b[x]=a[y=index(i,o[x])-i],b[x+1]=a[y+1],x+=2);puts(b);} 

Try it online!

# [C (gcc)], 181 bytes
char *a,*i,*o;c[4],x,y,z;g(x){x=x==82?0:x==71?1:x==66?2:3;}f(){a++;for(;z<2;z++){i=(z?o:i)+1;for(y=0;y<7;z?printf("%s%2X","#"+!!y,c[g(i[y])]):sscanf(a+y,"%2X",&c[g(i[y])]),y+=2);}} 

Try it online!

Creates a RGBA value in c[] array based on format i, then prints in o format

C (clang), 100 bytes

char *a,b[10],*i,*o;f(x,y){*b=*a;for(x=1;x<8;b[x]=a[y=index(i,o[x])-i],b[x+1]=a[y+1],x+=2);puts(b);} 

Try it online!

# [C (gcc)], 181 bytes
char *a,*i,*o;c[4],x,y,z;g(x){x=x==82?0:x==71?1:x==66?2:3;}f(){a++;for(;z<2;z++){i=(z?o:i)+1;for(y=0;y<7;z?printf("%s%2X","#"+!!y,c[g(i[y])]):sscanf(a+y,"%2X",&c[g(i[y])]),y+=2);}} 

Try it online!

Creates a RGBA value in c[] array based on format i, then prints in o format

C (clang), 89 bytes

char *a,b[10],*i,*o;f(x,y){*b=*a;for(x=1;x<8;b[x++]=a[y=index(i,o[x])-i],b[x++]=a[y+1]);} 

Try it online!

Takes input value in a, in format in i and out format in o. Returns out value in b

Minor cheat: storing result in b instead of printing to save bytes. Question doesn't disallow it.

# [C (clang)], 100 bytes
char *a,b[10],*i,*o;f(x,y){*b=*a;for(x=1;x<8;b[x]=a[y=index(i,o[x])-i],b[x+1]=a[y+1],x+=2);puts(b);} 

Try it online!

# [C (gcc)], 181 bytes
char *a,*i,*o;c[4],x,y,z;g(x){x=x==82?0:x==71?1:x==66?2:3;}f(){a++;for(;z<2;z++){i=(z?o:i)+1;for(y=0;y<7;z?printf("%s%2X","#"+!!y,c[g(i[y])]):sscanf(a+y,"%2X",&c[g(i[y])]),y+=2);}} 

Try it online!

Creates a RGBA value in c[] array based on format i, then prints in o format

new better submission
Source Link
GPS
  • 361
  • 1
  • 6

C (gcc)C (clang), 181100 bytes

char *a,*ib[10],*o;c[4]*i,*o;f(x,y,z;g(x){x=x==82?0:x==71?1:x==66?2:3;}f(){a++;for*b=*a;for(;z<2;z++){i=x=1;x<8;b[x]=a[y=index(z?o:i)+1;for(y=0;y<7;z?printf("%s%2X","#"+!!y,c[g(i[y])]o[x]):sscanf(a+y-i],"%2X"b[x+1]=a[y+1],&c[g(i[y])]x+=2),y+=2;puts(b);}}   

Try it online!Try it online!

Creates a RGBA value in c[] array based on format i, then prints in o format

# [C (gcc)], 181 bytes
char *a,*i,*o;c[4],x,y,z;g(x){x=x==82?0:x==71?1:x==66?2:3;}f(){a++;for(;z<2;z++){i=(z?o:i)+1;for(y=0;y<7;z?printf("%s%2X","#"+!!y,c[g(i[y])]):sscanf(a+y,"%2X",&c[g(i[y])]),y+=2);}} 

Try it online!

Creates a RGBA value in c[] array based on format i, then prints in o format

C (gcc), 181 bytes

char *a,*i,*o;c[4],x,y,z;g(x){x=x==82?0:x==71?1:x==66?2:3;}f(){a++;for(;z<2;z++){i=(z?o:i)+1;for(y=0;y<7;z?printf("%s%2X","#"+!!y,c[g(i[y])]):sscanf(a+y,"%2X",&c[g(i[y])]),y+=2);}}   

Try it online!

Creates a RGBA value in c[] array based on format i, then prints in o format

C (clang), 100 bytes

char *a,b[10],*i,*o;f(x,y){*b=*a;for(x=1;x<8;b[x]=a[y=index(i,o[x])-i],b[x+1]=a[y+1],x+=2);puts(b);} 

Try it online!

# [C (gcc)], 181 bytes
char *a,*i,*o;c[4],x,y,z;g(x){x=x==82?0:x==71?1:x==66?2:3;}f(){a++;for(;z<2;z++){i=(z?o:i)+1;for(y=0;y<7;z?printf("%s%2X","#"+!!y,c[g(i[y])]):sscanf(a+y,"%2X",&c[g(i[y])]),y+=2);}} 

Try it online!

Creates a RGBA value in c[] array based on format i, then prints in o format

Source Link
GPS
  • 361
  • 1
  • 6

C (gcc), 181 bytes

char *a,*i,*o;c[4],x,y,z;g(x){x=x==82?0:x==71?1:x==66?2:3;}f(){a++;for(;z<2;z++){i=(z?o:i)+1;for(y=0;y<7;z?printf("%s%2X","#"+!!y,c[g(i[y])]):sscanf(a+y,"%2X",&c[g(i[y])]),y+=2);}} 

Try it online!

Creates a RGBA value in c[] array based on format i, then prints in o format