Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Code shortening
Source Link
ErikF
  • 4.8k
  • 9
  • 11

C (gcc), (削除) 169 (削除ここまで) (削除) 166 (削除ここまで) 161(削除) 161 (削除ここまで) 160 bytes

Thanks to ceilingcat (x2x3) for the suggestions! I also changed the newlines in the header to spaces as they seem to work fine as separators (at least in Irfanview) and fixed a bug that got revealed when the array was put on the stack.

Generates an image in PBM format, as it's probably the simplest way to make a bitmap! For some reason, all the online PBM viewers that I tried don't seem to like the output file, but Irfanview and GIMP are fine with it.

z;f(r,w){char s[(w=r*2+11)*w+1];float x=s[w*w]=!memset(s,48,w*w);for(;x<7;x+=1e-5;x<7;)s[z=round(sin(xx+=1e-5)*r+r+5)+round(cos(x)*r+r+5)*w]=49;printf("P1 %d %d %s",w,w,s);}

Try it online! Try it online!

C (gcc), (削除) 169 (削除ここまで) (削除) 166 (削除ここまで) 161 bytes

Thanks to ceilingcat (x2) for the suggestions! I also changed the newlines in the header to spaces as they seem to work fine as separators (at least in Irfanview) and fixed a bug that got revealed when the array was put on the stack.

Generates an image in PBM format, as it's probably the simplest way to make a bitmap! For some reason, all the online PBM viewers that I tried don't seem to like the output file, but Irfanview and GIMP are fine with it.

z;f(r,w){char s[(w=r*2+11)*w+1];float x=s[w*w]=!memset(s,48,w*w);for(;x<7;x+=1e-5)s[z=round(sin(x)*r+r+5)+round(cos(x)*r+r+5)*w]=49;printf("P1 %d %d %s",w,w,s);}

Try it online!

C (gcc), (削除) 169 (削除ここまで) (削除) 166 (削除ここまで) (削除) 161 (削除ここまで) 160 bytes

Thanks to ceilingcat (x3) for the suggestions! I also changed the newlines in the header to spaces as they seem to work fine as separators (at least in Irfanview) and fixed a bug that got revealed when the array was put on the stack.

Generates an image in PBM format, as it's probably the simplest way to make a bitmap! For some reason, all the online PBM viewers that I tried don't seem to like the output file, but Irfanview and GIMP are fine with it.

z;f(r,w){char s[(w=r*2+11)*w+1];float x=s[w*w]=!memset(s,48,w*w);for(;x<7;)s[z=round(sin(x+=1e-5)*r+r+5)+round(cos(x)*r+r+5)*w]=49;printf("P1 %d %d %s",w,w,s);}

Try it online!

Code shortening
Source Link
ErikF
  • 4.8k
  • 9
  • 11

C (gcc), (削除) 169 (削除ここまで) 166(削除) 166 (削除ここまで) 161 bytes

Thanks to ceilingcat (x2) for the suggestions! I also changed the newlines in the header to spaces as they seem to work fine as separators (at least in Irfanview) and fixed a bug that got revealed when the array was put on the stack.

Generates an image in PBM format, as it's probably the simplest way to make a bitmap! For some reason, all the online PBM viewers that I tried don't seem to like the output file, but Irfanview and GIMP are fine with it.

fz;f(r,w){char s[(w=r*2+11)*w+1];float x=0;for(x=s[w*w]=!memset(s,48,w*w),s[w*w]=0;x<7;x+=1e;for(;x<7;x+=1e-5)s[(int)(rounds[z=round(sin(x)*r+r+5)+round(cos(x)*r+r+5)*w)]=49;printf*w]=49;printf("P1 %d %d %s",w,w,s);}

Try it online! Try it online!

C (gcc), (削除) 169 (削除ここまで) 166 bytes

Thanks to ceilingcat for the suggestions! I also changed the newlines in the header to spaces as they seem to work fine as separators (at least in Irfanview) and fixed a bug that got revealed when the array was put on the stack.

Generates an image in PBM format, as it's probably the simplest way to make a bitmap! For some reason, all the online PBM viewers that I tried don't seem to like the output file, but Irfanview and GIMP are fine with it.

f(r,w){char s[(w=r*2+11)*w+1];float x=0;for(memset(s,48,w*w),s[w*w]=0;x<7;x+=1e-5)s[(int)(round(sin(x)*r+r+5)+round(cos(x)*r+r+5)*w)]=49;printf("P1 %d %d %s",w,w,s);}

Try it online!

C (gcc), (削除) 169 (削除ここまで) (削除) 166 (削除ここまで) 161 bytes

Thanks to ceilingcat (x2) for the suggestions! I also changed the newlines in the header to spaces as they seem to work fine as separators (at least in Irfanview) and fixed a bug that got revealed when the array was put on the stack.

Generates an image in PBM format, as it's probably the simplest way to make a bitmap! For some reason, all the online PBM viewers that I tried don't seem to like the output file, but Irfanview and GIMP are fine with it.

z;f(r,w){char s[(w=r*2+11)*w+1];float x=s[w*w]=!memset(s,48,w*w);for(;x<7;x+=1e-5)s[z=round(sin(x)*r+r+5)+round(cos(x)*r+r+5)*w]=49;printf("P1 %d %d %s",w,w,s);}

Try it online!

Added information
Source Link
ErikF
  • 4.8k
  • 9
  • 11

C (gcc), (削除) 169 (削除ここまで) 166 bytes

Thanks to ceilingcat for the suggestions! I also changed the newlines in the header to spaces as they seem to work fine as separators (at least in Irfanview) and fixed a bug that got revealed when the array was put on the stack.

Generates an image in PBM format, as it's probably the simplest way to make a bitmap! For some reason, all the online PBM viewers that I tried don't seem to like the output file, but Irfanview and GIMP are fine with it.

f(r,w){char s[(w=r*2+11)*w+1];float x=0;for(memset(s,48,w*w),s[w*w]=0;x<7;x+=1e-5)s[(int)(round(sin(x)*r+r+5)+round(cos(x)*r+r+5)*w)]=49;printf("P1 %d %d %s",w,w,s);}

Try it online!

C (gcc), (削除) 169 (削除ここまで) 166 bytes

Thanks to ceilingcat for the suggestions! I also changed the newlines in the header to spaces as they seem to work fine as separators (at least in Irfanview) and fixed a bug that got revealed when the array was put on the stack.

Generates an image in PBM format, as it's probably the simplest way to make a bitmap!

f(r,w){char s[(w=r*2+11)*w+1];float x=0;for(memset(s,48,w*w),s[w*w]=0;x<7;x+=1e-5)s[(int)(round(sin(x)*r+r+5)+round(cos(x)*r+r+5)*w)]=49;printf("P1 %d %d %s",w,w,s);}

Try it online!

C (gcc), (削除) 169 (削除ここまで) 166 bytes

Thanks to ceilingcat for the suggestions! I also changed the newlines in the header to spaces as they seem to work fine as separators (at least in Irfanview) and fixed a bug that got revealed when the array was put on the stack.

Generates an image in PBM format, as it's probably the simplest way to make a bitmap! For some reason, all the online PBM viewers that I tried don't seem to like the output file, but Irfanview and GIMP are fine with it.

f(r,w){char s[(w=r*2+11)*w+1];float x=0;for(memset(s,48,w*w),s[w*w]=0;x<7;x+=1e-5)s[(int)(round(sin(x)*r+r+5)+round(cos(x)*r+r+5)*w)]=49;printf("P1 %d %d %s",w,w,s);}

Try it online!

Code shortening/correction
Source Link
ErikF
  • 4.8k
  • 9
  • 11
Loading
Source Link
ErikF
  • 4.8k
  • 9
  • 11
Loading

AltStyle によって変換されたページ (->オリジナル) /