2
\$\begingroup\$

New Posts and New Sandbox Posts are chatbots that occupy CGSE's main chatroom, The Nineteenth Byte. They've been doing their jobs for almost one full year now, so I thought I'd make a challenge to honor their contributions!

The challenge is simple: Draw the profile picture of either New Posts (NP) or New Sandbox Posts (NSP). Your program must take as input a boolean value, and draw NP's profile picture if true and NSP's profile picture if false. (They're identical except for the color difference.)

Here are the images you need to output:

New Posts' profile picture; a blue pixel-art cloud with "CGCC" written on it

New Sandbox Posts' profile picture; same as New Posts', but black instead of blue

The colors of each image should be #0093E8 (NP) and #000000 (NSP). If your language is unable to output that exact shade of blue you may use the closest equivalent. The background may be white or transparent.

The image can be saved to a file or piped raw to STDOUT in any common image file format, or it can be displayed in a window.

\$\endgroup\$
11
  • \$\begingroup\$ Note that it's Sandbox Posts (SP for short), New Sandbox Posts is the feed not the bot \$\endgroup\$ Apr 30 at 17:06
  • 1
    \$\begingroup\$ Also, what's the allowed input format? Presumably it doesn't have to be true or false since not all languages have that? I'd recommend going with the reverse of the normal decision problem rules: allow truthy/falsy, falsy/truthy, or any two consistent values. \$\endgroup\$ Apr 30 at 17:07
  • \$\begingroup\$ @RadvylfPrograms Except, of course, the code to draw the images or any other input that could assist in the code. \$\endgroup\$
    – ophact
    Apr 30 at 17:29
  • 1
    \$\begingroup\$ What if the closest color to the blue and black are the same? \$\endgroup\$
    – Yousername
    Apr 30 at 17:59
  • 1
    \$\begingroup\$ Here is the picture as hexa and binary. \$\endgroup\$
    – Arnauld
    Apr 30 at 18:22

2 Answers 2

3
\$\begingroup\$

PostScript, 132 112 + 4 bytes

x{0 .58 .91 setrgbcolor}if
9 9 scale 16 16 false[1 0 0 1 0 0]<~s8S_ka8b3"J.ITILd2AV!!%`RKQ2ZJ`^/O&rW<~>imagemask

Uses an ASCII Base-85 string to encode a 16x16 bitmap.

Takes input from command line: gs -dx=true np-nsp.ps or gs -dx=false np-nsp.ps; +4 bytes for -dx=. Output is displayed.

\$\endgroup\$
1
\$\begingroup\$

C (gcc), 295 bytes

shorter version thanks to @ceilingcat

#define p putchar(v?-1:b
*s=L"\xcd=C=C=7;104;104;10100.+6100.+6100.+6.3+3++.-.3+3++.-.3+3++.-.3+310.3+310.30.10.30B+30B+\xcf.D.0.D.0.D.0+;+1+3+;+1+3+;+1+3.8+1.0.5.1.0.5.1.C.J6I7I=1O1O1L1O1O1L.R.R.\xdf";main(b,v,n){b%=2;for(v=printf("P6 48 48 255 ");*s;v=!v)for(n=*s++-40;n--;p*232))p*0),p*147);}

Try it online!

C (GCC), 318 bytes

#define p(x)putchar(v?255:b*x)main(b,v,n){unsigned char*s="\xcd=C=C=7;104;104;10100.+6100.+6100.+6.3+3++.-.3+3++.-.3+3++.-.3+310.3+310.30.10.30B+30B+\xcf.D.0.D.0.D.0+;+1+3+;+1+3+;+1+3.8+1.0.5.1.0.5.1.C.J6I7I=1O1O1L1O1O1L.R.R.\xdf";b%=2;for(v=printf("P6 %d %d 255 ",48,48);*s;v=!v)for(n=*s++-40;n--;p(232))p(0),p(147);}

Attempt This Online!

Outputs a PPM image. The image is run-length encoded in the variable s.

The boolean input is given via the number of arguments (basically corresponds to argc % 2).

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.