3
\$\begingroup\$

During work on some project I needed to draw pixels on screen. I found some put-pixel function in JS, but code was quite big and clumsy - so I wonder, how small put-pixel function can be...

Challenge

Create the smallest put-pixel function.

We count size of whole program: initialization code (if needed), function and code necessary to draw the test case witch 11 pixels. If your language does not support functions, you can use what you have. Language must be capable of graphical output or drawing charts (saving files is not allowed).

The function (or program) should accept as input the following 6 independent integers pixel parameters (and other if needed):

  • x from 0 to at least 255 - horizontal position
  • y from 0 to at least 255 - vertical position
  • R from 0 to 255 - red color component
  • G from 0 to 255 - green color component
  • B from 0 to 255 - blue color component
  • A from 0 to 255 - alpha (if 0 then the pixel color is fully transparent, and we see old background pixel; if 255 then the pixel is completely opaque; for values 0<A<255 we calculate color in linear way, using the old and new pixel colors).

more parameters than above 6 is allowed and parameters can have any order. Number parameters can be strings and have base different than 10 or be coded in some way (if chosen language requires that).

Test case

On output you should draw following test-case with 11 pixels (I will use putPixel(x,y,R,G,B,A) as example to show case)

putPixel(126, 127, 255,   0,   0, 255) // Red
putPixel(127, 127,   0, 255,   0, 255) // Green
putPixel(128, 127,   0,   0, 255, 255) // Blue
putPixel(129, 127, 255,   0,   0, 255) // Red
putPixel(129, 127,   0, 255,   0, 127) // Dark Yellow (previous red + transparent green)

putPixel(126, 128,   0,   0,   0, 255) // Black
putPixel(127, 128, 255, 255, 255, 255) // White
putPixel(128, 128, 255,   0,   0, 255) // Red
putPixel(128, 128,   0,   0, 255, 127) // Dark pink (previous red + transparent blue)
putPixel(129, 128,   0, 255,   0, 255) // Blue
putPixel(129, 128,   0,   0, 255, 127) // Dark sea-blue (previous blue + transparent green)

We should see 8 pixel (but we paint 11pixel, but 3 of them are transparent paints on already colored pixels).

enter image description here

Leaderboard:

/* Configuration */

var QUESTION_ID = 250776; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 88163; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    lang = jQuery('<a>'+lang+'</a>').text();
    
    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });

  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);

  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body {
  text-align: left !important;
  display: block !important;
}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>
<div id="language-list">
  <h2>Shortest Solution by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">

    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>

\$\endgroup\$
17
  • \$\begingroup\$ If something is not clear in this question - write it in comments - I will edit it \$\endgroup\$ Aug 7 at 22:23
  • 3
    \$\begingroup\$ Request for clarification: other answerers have interpreted "code necessary to draw the test case" as including the test code itself, as opposed to just the code necessary to run it (as is more usual on Code Golf). If this is your intention, then how much are we allowed to golf the test code? If I declare a=127, b=128, c=255 and so on it can save a few bytes, but also I can save bytes by replacing some of the calls to the putPixel function with others that achieve the same image output with fewer calls in total... and I'm sure you didn't intend to allow that. So where is the line? \$\endgroup\$
    – kaya3
    Aug 8 at 10:38
  • 1
    \$\begingroup\$ It seems I can get my solution down to 307 bytes if hex strings are allowed; perhaps @KamilKiełczewski can clarify? \$\endgroup\$
    – kaya3
    Aug 8 at 12:31
  • 1
    \$\begingroup\$ Indeed, it's not trivial, and I don't blame you for not wanting to specify your challenge in such detail. This is why Code Golf challenges normally don't count the size of the test code towards the score... \$\endgroup\$
    – kaya3
    Aug 8 at 12:54
  • 2
    \$\begingroup\$ Regarding parameters, @kaya3: I believe it's OK to have as many/as few parameters as desired when defining the function as long as you can pass six (or more) values separately. It's OK if you pass a single array if it contains the three separate values for R, G and B. No need to restrict input that much. Where's the (more than technical) difference if you write p(x,y,[R,G,B],A) instead of p(x,y,R,G,B,A) or p(xxyyRRGGBBaa)? You should, however, imho not mix multiple values into one parameter, e.g. 16777215 for FFFFFF meaning "white" since you cannot change the inputs independently in this case. \$\endgroup\$
    – Joe85AC
    Aug 8 at 13:56

9 Answers 9

6
\$\begingroup\$

TikZ, 333, 322, 307 bytes

  • Wrapper (\documentclass..., \begin.../\end{document}, and \tikz{}): 66 bytes
  • Definition of Macro ~: 113, 112 97 bytes
  • Test Cases: 14 + 10 x 13 bytes = 144 bytes (154 bytes)

Compact Code

\documentclass[tikz]{standalone}\def~{document}\begin~\tikz{\def~#1#2#3#4#5#6#7;{\color[HTML]{#7}\fill[opacity=(0x#5#6)/255](0x#1#2,-0x#3#4)rectangle++(,);~}~7E7FFFff0000;7F7FFF00ff00;807FFF0000ff;817FFFff0000;817F7F00ff00;7E80FF000000;7F80FFffffff;8080FFff0000;80807F0000ff;8180FF00ff00;81807F0000ff;}\end~

Try It Online

Output

PNG version of the PDF output

The code produces a PDF file (vector graphic image); the picture above is a PNG image produced by conversion via pdf2png.com.

Readable Version of the Code

01: \documentclass[tikz]{standalone}\def~{document}\begin~\tikz{
02: \def~#1#2#3#4#5#6#7;{
03:     \color[HTML]{#7}
04:     \fill[opacity=(0x#5#6)/255]
05:     (0x#1#2,-0x#3#4)rectangle++(,);
06: ~}
07: ~7E7FFFff0000;
08: 7F7FFF00ff00;
09: 807FFF0000ff;
10: 817FFFff0000;
11: 817F7F00ff00;
12: 7E80FF000000;
13: 7F80FFffffff;
14: 8080FFff0000;
15: 80807F0000ff;
16: 8180FF00ff00;
17: 81807F0000ff;
18: }\end~

Explanation

Lines 1 and 18

Defining ~ as document outside of the document-scope allows for saving three bytes when writing \begin~ and \end~. Note: ~ is the only "active char" in LaTeX.

Lines 2 and 6

Defining ~ within the document-scope does not interfere with the definition outside of the document scope. We define ~ to be a macro with seven parameters,

  • parameters 1 and 2 being the two hex digits for the x-coordinate,
  • parameters 3 and 4 being the two hex digits for the y-coordinate,
  • parameters 5 and 6 being the two hex digits for the opacity, and
  • parameter 7 being the color which will be provided as HTML color.

; denotes the end of the HTML color string. We could omit this if we used a technique that helps to use more than nine arguments. However, we don't use this approach here because using more than nine arguments would add more than the 11 bytes (coming from the eleven ; in the eleven test cases) that we could possibly save. Note that if we had to deal with several hundred test cases, we would rather opt for omitting the ; and, thus, for allowing for more than nine arguments.

The definition of the macro ends with } in line 7. Before ending the definition, we call the macro itself again. This allows us to refrain from repeating the ~ character multiple times when inputting the test case. Note that this produces a "recoverable error" when the last pixel is printed. However, a graphical output is generated nevertheless.

Line 3

We define the color that we will use to draw the pixel. The RGB values provided in the test cases have been converted to the HTML model in the obvious manner. Since we are required to use integers, we note explicitly that we do observe this requirement by making use of hex integers!

Line 4

We use the \fill-command to draw the pixel, and we set the opacity.

Line 5

We provide the coordinates as hex integers. Note that the y-coordinate is prefixed with a - because TikZ has its origin in the bottom left corner of the screen whereas the task provides a test case output that clearly shows its origin to be in the top left corner of the screen. The height and the width of each pixel will be 1 cm. (,) is equivalent to (1,1). The standard unit for coordinates is centimeter.

We also close the scope of the definition of ~ as shorthand for numexpr.

Lines 7, 8, ..., 17

Test cases / output.

Improvements

Please help me to get better. If you know TikZ and if you can save some more bytes, please make sure to comment on this solution. Thank you!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ 🚀 (you win "currently shortest answer" mark (which can be temporary)) \$\endgroup\$ Aug 7 at 22:22
5
\$\begingroup\$

C (tcc) + sh + imagemagick, 454 bytes

  • C code: 434 bytes (removing newlines)
  • filename: 1 byte
  • shell command: 18 bytes

--

#define p(x,y,R,G,B,A){int*j=i+(x+y*w)*3,C[3]={R,G,B};for(k=0;k<3;++k)j[k]=(C[k]*A+j[k]*(w-A))/w;}
w=255;c;
main(k){
int*i=calloc(w*w,12);
p(126,127,255,0,0,255)
p(127,127,0,255,0,255)
p(128,127,0,0,255,255)
p(129,127,255,0,0,255)
p(129,127,0,255,0,127)
p(126,128,0,0,0,255)
p(127,128,255,255,255,255)
p(128,128,255,0,0,255)
p(128,128,0,0,255,127)
p(129,128,0,255,0,255)
p(129,128,0,0,255,127)
puts("P6 255 255 255");
for(;c<w*w*3;)
putchar(i[c++]);
}

Assuming the code is saved in a file named a, run tcc -run a|display.

\$\endgroup\$
2
  • 3
    \$\begingroup\$ 1️⃣ <- this is "first answer silver medal" for you :) \$\endgroup\$ Aug 7 at 19:22
  • \$\begingroup\$ When creating my solution, the requirement "at least 255" immediately pointed me to 2-digit hex integers. You might want to check whether this thought might save you a couple of bytes... ;-) \$\endgroup\$
    – Joe85AC
    Aug 7 at 22:10
4
\$\begingroup\$

C#, .NET 6.0, Windows Forms, 452 443 435 bytes

Application.EnableVisualStyles();Form F=new();List<int[]>L=new();void P(params int[]a)=>L.Add(a);F.Paint+=(s,e)=>L.ForEach(p=>e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(p[5],p[2],p[3],p[4])),p[0],p[1],1,1));int a=127,b=128,c=129,z=255;P(126,a,z,0,0,z);P(a,a,0,z,0,z);P(b,a,0,0,z,z);P(c,a,z,0,0,z);P(c,a,0,z,0,a);P(126,b,0,0,0,z);P(a,b,z,z,z,z);P(b,b,z,0,0,z);P(b,b,0,0,z,a);P(c,b,0,z,0,z);P(c,b,0,0,z,a);Application.Run(F);

To run this, put the above in a file, e.g. x.cs and create a project file, e.g. x.csproj as follows:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net6.0-windows</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <UseWindowsForms>true</UseWindowsForms>
    </PropertyGroup>
</Project>

Then run it with dotnet run.

Explanation:

// Initialise graphics
Application.EnableVisualStyles();
var F=new Form();

// Definition of the function P adds its parameters to a list of pixels
var L=new List<int[]>();
void P(params int[]a)=>L.Add(a);

// Paint method fills a rectangle for each pixel in the list
F.Paint+=(s,e)=>L.ForEach(p=>e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(p[5],p[2],p[3],p[4])),p[0],p[1],1,1));

// Test case (golfed)
int a=127,b=128,c=129,z=255;
P(126,a,z,0,0,z);
P(a,a,0,z,0,z);
P(b,a,0,0,z,z);
P(c,a,z,0,0,z);
P(c,a,0,z,0,a);
P(126,b,0,0,0,z);
P(a,b,z,z,z,z);
P(b,b,z,0,0,z);
P(b,b,0,0,z,a);
P(c,b,0,z,0,z);
P(c,b,0,0,z,a);

// Finally run the application
Application.Run(F);

Improvements

  • Use new() syntax to save the bytes of var
  • Use the Graphics property of the PaintEventArgs instead of calling CreateGraphics() on the Form.
\$\endgroup\$
3
  • \$\begingroup\$ 359 bytes \$\endgroup\$
    – jdt
    Aug 10 at 14:23
  • \$\begingroup\$ Sure, jdt, your code is shorter but it doesn't include a Put-Pixel function that you can call to draw a pixel. You just have pixel data in an array, not a function. \$\endgroup\$ Aug 12 at 1:13
  • \$\begingroup\$ point taken ;-) You don't really need Application.EnableVisualStyles(); and the following saves a couple of bytes: F.Paint+=(s,e)=>L.ForEach(p=>e.Graphics.DrawArc(new Pen(Color.FromArgb(p[5],p[2],p[3],p[4])),p[0],p[1],1,1,0,9));. \$\endgroup\$
    – jdt
    Aug 12 at 13:32
2
\$\begingroup\$

JavaScript + Canvas, 405 329 bytes

d=document
d.body.append(c=d.createElement('canvas'))
c=c.getContext('2d')
p=(x,y,a,...r)=>{c.fillStyle=`rgba(${r},${a/k})`;c.fillRect(x,y,1,1)}
p(126,g=127,k=255,k,0,0)
p(g,g,k,0,k,0)
p(h=128,g,k,0,0,k)
p(j=129,g,k,k,0,0)
p(j,g,g,0,k,0)
p(126,h,k,0,0,0)
p(g,h,k,k,k,k)
p(h,h,k,k,0,0)
p(h,h,g,0,0,k)
p(j,h,k,0,k,0)
p(j,h,g,0,0,k)

The fill-style is set by coercing an array to a string in order to get the commas, and also to save on declaring a couple of parameters.

The alpha parameter is taken before the r,g,b rest parameter, and it has to be divided by 255; it saves two bytes to reuse the variable k for this, which is assigned on the next line but that occurs before the function is called for the first time. This raises the question of whether the function itself is allowed to depend on the test code...

Thanks to @Kaiido for informing me about append (vs. appendChild).

Without the test code, it would be 146 bytes (including +2 for replacing k with 255).

\$\endgroup\$
18
  • \$\begingroup\$ Sorry to bother, but you will have to count the input for the text cases as well. That's stated in the rules. Even if we omit "wrappers" like <script></script> that you will most certainly need for your code to be executed, this solution is at least 244 bytes LONGER. Those bytes come from the way you formulate your test cases... :-/ \$\endgroup\$
    – Joe85AC
    Aug 8 at 5:39
  • \$\begingroup\$ @Joe85AC The OP says to count "initialization code (if needed), function and code necessary to draw the test case", I would normally interpret "code necessary to draw the test case" as not including the code that actually performs the test, particularly because that is normal on Code Golf and also generally a test is not part of the program it is testing. But I see your answer and the other one have included the test code in the byte count too. I will edit, but I think the OP should clarify this, because it also raises the question of how much we're allowed to golf the test code... \$\endgroup\$
    – kaya3
    Aug 8 at 10:28
  • 1
    \$\begingroup\$ By the way, you don't need to write any HTML tags to execute JavaScript code - you can paste it straight into the browser console, for example. \$\endgroup\$
    – kaya3
    Aug 8 at 10:34
  • \$\begingroup\$ Agreed: HTML tags are not needed. You're completely right here. On a side note: Golfing your input with parseInt(...,16) might save a few bytes. \$\endgroup\$
    – Joe85AC
    Aug 8 at 10:41
  • 3
    \$\begingroup\$ Right, but how golfable should it be? It would certainly be against the spirit of the challenge to replace transparent pixels with opaque ones that produce the same output, for example, and it also seems wrong to change the function body so that I can pass y as 0 or 1 instead of 127 or 128. But removing whitespace is clearly OK. So there is a line to be drawn somewhere, and I will wait until it's drawn. \$\endgroup\$
    – kaya3
    Aug 8 at 10:56
2
\$\begingroup\$

Java 8, 441 433 bytes

import java.awt.*;class M{static Graphics g;public static void main(String[]s){new Frame(){public void paint(Graphics G){g=G;int a=127,b=128,z=255;p(126,a,z,0,0,z);p(a,a,0,z,0,z);p(b,a,0,0,z,z);p(129,a,z,0,0,z);p(129,a,0,z,0,a);p(126,b,0,0,0,z);p(a,b,z,z,z,z);p(b,b,z,0,0,z);p(b,b,0,0,z,a);p(129,b,0,z,0,z);p(129,b,0,0,z,a);}{show();}};}static void p(int...a){g.setColor(new Color(a[2],a[3],a[4],a[5]));g.fillRect(a[0],a[1],10,10);}}

Java is one of the reasons why we allow both programs and functions for codegolf challenges, since the additional fluff is so dang verbose.. :/

  • Initialization code: 146 bytes
  • Actual draw pixel method: 88 bytes
  • 11 test cases: 199 bytes

Explanation:

Initialization code:

import java.awt.*;        // Required import for Frame, Graphics, and Color
class M{                  // Class
  static Graphics g;      //  With (static) class-variable Graphics object to save bytes
  public static void main(String[]s){
                          //  Mandatory main method
    new Frame(){          //   Create a new Frame to draw on
      public void paint(Graphics G){
                          //    Overwrite its paint method
        g=G;              //     Set the class-variable Graphics object
                          /*     Test cases */
      }                   //    Close the paint-method
      {                   //    Open an initializer-block of the Frame:
        show();           //     Show the Frame
      }                   //    Close the initializer-block
    };                    //   Close the Frame
  }                       //  Close the main-method
  static                  //  Static block for the draw pixel method
                          /*  Draw pixel method */
}                         // Close the class

Draw pixel method:

void p(int...a){          // Draw pixel method with variable length integer parameters
  g.setColor(new Color(   //  Set a new color
    a[2],a[3],a[4],a[5]));//  using the 3rd to 6th parameters as red,green,blue,alpha
  g.fillRect(             //  And create a rectangle
    a[0],a[1],            //  at x,y-position using the 1st & 2nd parameters
    1,1);                 //  of 1 by 1 pixel
}                         // Close the draw pixel method

Test cases:

int a=127,b=128,z=255;    // Create three variables to save bytes
p(126,a,z,0,0,z);p(a,a,0,z,0,z);p(b,a,0,0,z,z);p(129,a,z,0,0,z);p(129,a,0,z,0,a);p(126,b,0,0,0,z);p(a,b,z,z,z,z);p(b,b,z,0,0,z);p(b,b,0,0,z,a);p(129,b,0,z,0,z);p(129,b,0,0,z,a);
                          // Draw the 11 pixels

Screenshot (using enlarged 10x10 pixels instead of 1x1):

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ This Golf seems to be made for Java if we only look at the actual function. 88 bytes is brilliant! \$\endgroup\$
    – Joe85AC
    Aug 8 at 15:19
  • \$\begingroup\$ @Joe85AC Java always has tons of boilerplate, making seemingly good answers into bad ones \$\endgroup\$
    – user253751
    Aug 8 at 15:55
2
\$\begingroup\$

C + Win32 GDI, 508 bytes

#include<Windows.h>
A=127,B=128,C=129,Z=255;h,d,o,c,m;p(x,y,R,G,B,a){o=GetPixel(d=GetDC(h),x,y),c=RGB(R,G,B);SetPixel(d,x,y,((((256-a)*(o&0xFF00FF))>>8|(a*(c&0xFF00FF))>>8)&0xFF00FF)+((((256-a)*(o&65280))>>8|(a*(c&65280))>>8)&65280));}main(){for(h=CreateWindow("STATIC","",1<<28,0,0,Z,Z,0,0,0,0);GetMessage(&m,h,0,0);)DispatchMessage(&m),p(126,A,Z,0,0,Z),p(A,A,0,Z,0,Z),p(B,A,0,0,Z,Z),p(C,A,Z,0,0,Z),p(C,A,0,Z,0,A),p(126,B,0,0,0,Z),p(A,B,Z,Z,Z,Z),p(B,B,Z,0,0,Z),p(B,B,0,0,Z,A),p(C,B,0,Z,0,Z),p(C,B,0,0,Z,A);}

Slightly ungolfed:

#include <Windows.h>

int h, d, o, c, m;

p(x, y, R, G, B, a)
{
    d = GetDC(h);
    o = GetPixel(d, x, y);
    c = RGB(R, G, B);
    SetPixel(d, x, y, ((((0x100 - a) * (o & 0xFF00FF)) >> 8 | (a * (c & 0xFF00FF)) >> 8) & 0xFF00FF) + ((((0x100 - a) * (o & 65280)) >> 8 | (a * (c & 65280)) >> 8) & 65280));
}

main()
{
    h = CreateWindow("STATIC", "", 1 << 28, 0, 0, 199, 199, 0, 0, 0, 0);
    while (GetMessage(&m, h, 0, 0))
    {
        DispatchMessage(&m);
        int A = 127, B = 128, C = 129, Z = 255;
        p(126, A, Z, 0, 0, Z);
        p(A, A, 0, Z, 0, Z);
        p(B, A, 0, 0, Z, Z);
        p(C, A, Z, 0, 0, Z);
        p(C, A, 0, Z, 0, A);
        p(126, B, 0, 0, 0, Z);
        p(A, B, Z, Z, Z, Z);
        p(B, B, Z, 0, 0, Z);
        p(B, B, 0, 0, Z, A);
        p(C, B, 0, Z, 0, Z);
        p(C, B, 0, 0, Z, A);
    }
}
\$\endgroup\$
1
\$\begingroup\$

JSFuck, 30220 29681 29542 29353 bytes

This is JSFuck (subset of JS which use only []()!+ characters) port of this solution

[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]](([]+(+!![])+![]+(+!![])+(+[])+(+!![])+![]+!![]+!![]+(+!![])+![]+(+[])+!![]+(+!![])+!![]+(+!![])+(+!![])+(+!![])+![]+!![]+(+!![])+(+!![])+![]+(+!![])+(+!![])+(+!![])+![]+!![]+![]+(+!![])+!![]+(+!![])+(+[])+(+[])+![]+!![]+![]+(+!![])+!![]+(+!![])+!![]+(+!![])+!![]+(+[])+![]+(+!![])+![]+![]+(+!![])+(+!![])+!![]+(+!![])+(+[])+(+!![])+![]+(+!![])+(+!![])+(+!![])+![]+(+[])+(+[])+(+[])+!![]+!![]+(+[])+(+!![])+![]+(+[])+!![]+(+!![])+![]+(+[])+(+!![])+(+!![])+![]+!![]+![]+(+!![])+!![]+(+!![])+![]+(+!![])+![]+(+[])+(+!![])+(+!![])+!![]+(+[])+!![]+(+[])+![]+(+[])+(+[])+(+!![])+![]+![]+(+!![])+(+!![])+![]+(+!![])+(+[])+(+[])+!![]+!![]+(+!![])+(+!![])+(+!![])+![]+(+!![])+(+[])+!![]+!![]+![]+(+!![])+![]+(+[])+(+[])+(+[])+(+[])+![]+![]+(+!![])+![]+(+[])+!![]+(+[])+!![]+!![]+(+!![])+(+!![])+(+!![])+![]+(+!![])+(+[])+![]+!![]+![]+(+!![])+![]+(+!![])+!![]+(+!![])+![]+(+!![])+(+!![])+(+!![])+!![]+(+!![])+(+[])+(+!![])+(+[])+(+[])+!![]+(+!![])+![]+!![]+!![]+(+!![])+![]+!![]+![]+(+!![])+!![]+(+!![])+(+[])+(+!![])+![]+(+!![])+(+!![])+(+!![])+!![]+![]+(+[])+(+!![])+!![]+(+!![])+(+[])+(+!![])+![]+(+[])+(+[])+(+[])+!![]+(+[])+![]+(+!![])+![]+(+!![])+(+[])+(+!![])+![]+(+[])+(+[])+(+[])+(+[])+![]+![]+(+!![])+!![]+(+[])+(+[])+(+[])+!![]+!![]+(+!![])+(+[])+![]+![]+(+[])+(+!![])+!![]+![]+(+[])+(+[])+![]+!![]+(+[])+(+!![])+!![]+![]+(+!![])+(+[])+![]+!![]+(+[])+(+!![])+![]+(+[])+(+!![])+(+[])+![]+!![]+(+[])+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+!![])+!![]+(+[])+![]+(+[])+![]+![]+(+!![])+(+[])+!![]+!![]+(+!![])+(+[])+!![]+!![]+![]+(+!![])+!![]+![]+!![]+(+!![])+![]+(+[])+!![]+(+[])+![]+!![]+![]+(+!![])+![]+(+!![])+![]+(+!![])+![]+![]+(+!![])+(+!![])+![]+!![]+(+[])+(+!![])+![]+!![]+(+[])+(+!![])+(+!![])+(+[])+!![]+(+!![])+!![]+(+!![])+(+[])+(+!![])+!![]+![]+(+!![])+(+!![])+![]+!![]+(+[])+(+!![])+![]+(+!![])+(+!![])+(+[])+!![]+!![]+(+!![])+(+!![])+![]+(+[])+(+[])+(+!![])+!![]+(+[])+![]+(+!![])+![]+(+!![])+!![]+(+!![])+![]+(+[])+![]+(+!![])+![]+(+[])+(+!![])+(+[])+![]+![]+(+[])+(+[])+![]+(+!![])+(+[])+(+!![])+!![]+![]+!![]+(+!![])+!![]+(+[])+![]+(+!![])+!![]+!![]+(+!![])+(+[])+![]+!![]+(+[])+(+[])+![]+(+!![])+(+[])+(+!![])+!![]+![]+!![]+(+!![])+![]+(+[])+(+!![])+(+[])+![]+!![]+!![]+(+[])+!![]+(+[])+![]+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+(+!![])+(+!![])+(+!![])+!![]+!![]+(+!![])+(+[])+![]+![]+(+!![])+(+!![])+![]+(+[])+(+[])+(+[])+!![]+![]+!![]+(+!![])+![]+(+[])+!![]+(+[])+![]+!![]+![]+(+!![])+![]+(+!![])+![]+(+!![])+![]+![]+(+!![])+(+!![])+![]+!![]+(+[])+(+!![])+![]+!![]+(+[])+(+!![])+(+!![])+(+[])+![]+(+!![])+![]+(+!![])+(+!![])+(+!![])+![]+(+[])+!![]+(+!![])+!![]+(+!![])+(+[])+(+[])+![]+![]+(+[])+(+!![])+!![]+![]+(+[])+(+[])+![]+!![]+(+[])+(+!![])+!![]+![]+(+!![])+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+![]+![]+(+!![])+(+!![])+!![]+!![]+(+!![])+(+[])+(+[])+![]+![]+(+[])+![]+![]+(+[])+(+[])+!![]+(+[])+(+[])+(+!![])+!![]+![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+!![]+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+![]+(+!![])+![]+(+!![])+![]+(+!![])+![]+(+[])+![]+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+(+!![])+![]+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+![]+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+!![]+(+[])+!![]+![]+(+!![])+(+[])+!![]+(+[])+(+[])+(+!![])+![]+(+!![])+(+!![])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+(+!![])+(+!![])+(+!![])+![]+(+[])+(+!![])+(+!![])+![]+(+!![])+(+[])+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+(+[])+![]+(+!![])+![]+(+!![])+(+!![])+(+[])+!![]+(+[])+![]+(+!![])+![]+(+!![])+(+[])+(+!![])+![]+(+!![])+(+!![])+(+!![])+![]+(+[])+![]+(+!![])+![]+(+[])+![]+(+[])+!![]+(+[])+![]+(+[])+!![]+(+[])+!![]+(+[])+!![]+(+!![])+(+!![])+(+!![])+![]+(+!![])+![]+(+!![])+![]+(+!![])+(+[])+(+!![])+![]+(+[])+![]+(+[])+!![]+(+!![])+(+[])+(+[])+!![]+![]+(+[])+(+!![])+![]+(+!![])+(+[])+(+!![])+![]+(+[])+!![]+(+[])+!![]+(+!![])+(+[])+(+[])+!![]+![]+(+!![])+(+[])+!![]+(+!![])+(+!![])+(+!![])+![]+(+[])+![]+(+[])+!![]+(+!![])+!![]+(+!![])+![]+(+[])+![]+(+[])+!![]+(+!![])+![]+(+[])+!![]+![]+(+!![])+(+[])+!![]+(+!![])+(+!![])+(+!![])+![]+(+!![])+(+!![])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+!![])+![]+(+[])+!![]+(+[])+(+[])+(+[])+!![]+(+!![])+(+!![])+(+!![])+![]+!![]+![]+(+[])+![]+![]+!![]+(+[])+![]+(+!![])+!![]+(+[])+![]+(+!![])+!![]+(+[])+![]+![]+(+!![])+(+[])+![]+!![]+![]+(+!![])+!![]+(+[])+![]+(+!![])+![]+(+!![])+(+!![])+(+!![])+!![]+(+[])+(+[])+(+!![])+![]+!![]+(+[])+(+!![])+![]+(+[])+(+!![])+(+!![])+![]+(+[])+!![]+(+!![])+![]+(+!![])+(+!![])+(+[])+![]+![]+(+[])+(+[])+![]+!![]+!![]+(+[])+![]+!![]+![]+(+!![])+!![]+![]+!![]+(+[])+!![]+(+!![])+![]+(+!![])+!![]+!![]+(+!![])+(+[])+![]+!![]+!![]+(+!![])+![]+(+!![])+!![]+(+[])+![]+!![]+(+[])+(+!![])+!![]+![]+(+[])+(+[])+!![]+!![]+(+!![])+(+[])+!![]+!![]+![]+(+!![])+!![]+(+[])+(+[])+(+[])+![]+![]+(+[])+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+!![])+(+!![])+![]+!![]+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+[])+![]+!![]+![]+(+!![])+!![]+![]+(+[])+(+!![])+(+!![])+!![]+(+!![])+(+[])+![]+!![]+![]+(+!![])+![]+!![]+(+!![])+(+!![])+![]+(+[])+(+!![])+(+!![])+!![]+(+[])+(+[])+(+[])+![]+![]+(+[])+(+!![])+!![]+(+!![])+(+!![])+(+[])+!![]+!![]+(+!![])+(+[])+!![]+!![]+![]+(+!![])+(+!![])+![]+!![]+(+[])+!![]+(+[])+(+[])+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+(+!![])+![]+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+(+!![])+!![]+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+![]+(+[])+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+(+!![])+(+[])+!![]+(+[])+![]+(+[])+!![]+![]+(+!![])+(+[])+![]+!![]+(+[])+(+[])+!![]+(+[])+![]+(+[])+!![]+(+!![])+(+!![])+(+[])+!![]+(+!![])+(+!![])+(+!![])+(+!![])+!![]+(+!![])+(+!![])+(+!![])+![]+!![]+(+!![])+!![]+(+!![])+(+!![])+(+!![])+(+!![])+!![]+(+!![])+(+[])+![]+![]+(+!![])+(+[])+![]+![]+(+!![])+(+[])+![]+![]+(+!![]))[[]+([]+![])[!![]+!![]+!![]]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]]([]+!![])[[]+([][[]+([]+!![])[!![]+!![]+!![]]+([]+[][[]])[+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()+[])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]])[+!![]]](!![]+!![]+!![])[[]+([]+![])[!![]+!![]+!![]]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]]([]+![])[[]+([][[]+([]+!![])[!![]+!![]+!![]]+([]+[][[]])[+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()+[])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]])[+!![]]](!![]+!![])[[]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+![])[+!![]]+([]+!![])[+![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(+([]+(+!![])+(!![]+!![]+!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![])+(+[])))]([][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]([]+([]+!![])[+!![]]+([]+!![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[!![]+!![]]+([]+!![])[+!![]]+([]+[][[]])[+!![]]+(![]+[+[]])[[]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()[[]+(+!![])+(+[])]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(![]+[+[]])[[]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()[[]+(+!![])+(+[])]+(![]+[+[]]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]])[+([]+(!![]+!![])+(+[]))])())[[]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+![])[+!![]]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))]([][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]([]+([]+!![])[+!![]]+([]+!![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[!![]+!![]]+([]+!![])[+!![]]+([]+[][[]])[+!![]]+(+[![]]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[+([]+(+!![])+(+!![]))]+([]+![])[+[]]+([]+[])[[]+([]+![])[+[]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+!![])[+![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+![])[!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]()[+([]+(+!![])+(+!![]))]+([]+[])[[]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()[!![]+!![]]+([+[]]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+![])[!![]+!![]]+([]+![])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+![])[!![]+!![]]+([]+![])[!![]+!![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]])[+([]+(+!![])+(+[]))]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]])[+!![]]+(![]+[+[]]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]])[+([]+(!![]+!![])+(+[]))]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+([]+![])[+[]]+([]+!![])[+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]([]+([]+!![])[+!![]]+([]+!![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[!![]+!![]]+([]+!![])[+!![]]+([]+[][[]])[+!![]]+(+[![]]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[+([]+(+!![])+(+!![]))]+([]+!![])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[+!![]]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))+([]+!![])[!![]+!![]+!![]])()(([]+[])[[]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]())[!![]+!![]]+(+([]+(+!![])+(!![]+!![]+!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![])+(+[])))+([]+![])[+!![]]+([]+!![])[+!![]]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]([]+([]+!![])[+!![]]+([]+!![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[!![]+!![]]+([]+!![])[+!![]]+([]+[][[]])[+!![]]+(+[![]]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[+([]+(+!![])+(+!![]))]+([]+!![])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[+!![]]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))+([]+!![])[!![]+!![]+!![]])()(([]+[])[[]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[+![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]())[!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([][[]]+[])[!![]+!![]]+([]+!![])[!![]+!![]+!![]]+([][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]]+[])[+([]+(+!![])+(!![]+!![]+!![]))]+(+([]+(!![]+!![])+(!![]+!![]+!![]+!![]+!![])))[[]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]][[]+([]+[][[]])[+!![]]+([]+![])[+!![]]+((+[])[[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+!![])[!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[+![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+!![])[+!![]]]+[])[[]+(+!![])+(+!![])]+([]+!![])[!![]+!![]+!![]]]](+([]+(!![]+!![]+!![])+(+[])))+([]+![])[+!![]]+([]+!![])[+!![]]+([]+![])[!![]+!![]+!![]]+([]+!![])[!![]+!![]+!![]]+([]+(+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])))[+[]]+([]+[][[]])[+!![]]+([]+!![])[+![]]+([][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]]+[])[+([]+(+!![])+(!![]+!![]+!![]))]+([]+![])[+[]]+([][[]+([]+![])[!![]+!![]+!![]]+([]+![])[!![]+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+!![])[!![]+!![]+!![]]][[]+([]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[!![]+!![]+!![]]+([]+![])[+!![]]+([]+![])[!![]+!![]]+([]+![])[!![]+!![]]](![]+[])+[])[+!![]]+(!![]+!![]+!![]+!![])+([+[]]+![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[+([]+(!![]+!![])+(+[]))]+([+[]]+![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[+([]+(!![]+!![])+(+[]))])())[[]+([][[]+([]+!![])[!![]+!![]+!![]]+([]+[][[]])[+!![]]+([]+!![])[+![]]+([]+!![])[+!![]]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+!![])[!![]+!![]+!![]]+([]+![])[!![]+!![]+!![]]]()+[])[!![]+!![]+!![]]+(!![]+[][[]+([]+![])[+[]]+([]+![])[!![]+!![]]+([]+![])[+!![]]+([]+!![])[+![]]])[[]+(+!![])+(+[])]+([]+[][[]])[!![]+!![]+!![]+!![]+!![]]+([]+[][[]])[+!![]]]([]))()

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

simply, 321 bytes

This is a very verbose language that I've been writing for a while now.

It uses the canvas module, to do all the drawing.
This is based on the HTML <canvas> and the JavaScript canvas.getContent('2d').

$C=call!CANVAS->init(256,256)def&p($x$y$R$G$B$A)call$C->fillRect($x$y,1,1&str_concat("rgba("$R','$G','$B','&div($A,255)')'))&p($a=126$b=127$F=255,0,0$F)&p($b$b,0$F,0$F)&p($c=128$b,0,0$F$F)&p($d=129$b$F,0,0$F)&p($d$b,0$F,0$b)&p($a$c,0,0,0$F)&p($b$c$F$F$F$F)&p($c$c$F,0,0$F)&p($c$c,0,0$F$b)&p($d$c,0$F,0$F)&p($d$c,0,0$F$b);

This generates a 256x256 canvas, due to the X and Y being in the 0-255 range.

Result (raw and zoomed):
Raw result Zoomed in result


Explanation:

Generates the canvas, 29 bytes

$C=call!CANVAS->init(256,256)

All it does is really that: create the canvas.
It's assigned to a local variable, because of the next point.

Draws the pixels, 95 bytes

def&p($x$y$R$G$B$A)call$C->fillRect($x$y,1,1&str_concat("rgba("$R','$G','$B','&div($A,255)')'))

Defines the function that will do all the drawing.
There's no scope opening, so, it takes the next statement as the whole function code.
This is similar to C-like if(cond) do_something();, but applied to functions.

This gives access to the local variables to that single statement, which won't happen for a function with a new scope.

Pixel data, 197 bytes

&p($a=126$b=127$F=255,0,0$F)&p($b$b,0$F,0$F)&p($c=128$b,0,0$F$F)&p($d=129$b$F,0,0$F)&p($d$b,0$F,0$b)&p($a$c,0,0,0$F)&p($b$c$F$F$F$F)&p($c$c$F,0,0$F)&p($c$c,0,0$F$b)&p($d$c,0$F,0$F)&p($d$c,0,0$F$b);

All the data to draw.

There's a mix between commas (,) and variables glued to values.
This is intentional, as the language doesn't care (much) if there's a comma or not, as long as they are 2 distinct tokens.


Ungolfed code:

// Creates the 256x256 canvas, and displays it
// This uses a global variable (starts with %), so it is available in &putPixel
Set %canvas to the result of calling !CANVAS->init(256, 256).

// This is the function that does the drawing
Define the function &putPixel with the arguments $x, $y, $R, $G, $B, $A.
Begin.
    // $alpha has to be between 0 and 1, so, needs to be divided by 255.
    Set $alpha to the result of calling &div($A, 255).
    
    // Sets $style to the rgba(...) value for the pixel
    Set $style to the result of calling &str_concat("rgba(", $R, ',', $G, ',', $B, ',', $alpha, ')').
    
    // This is the function that does the drawing
    Call the function %canvas->fillRect($x, $y, 1, 1, $style).
End.

// From here on, everything is just the pixel data

// 🟥 Red
Call the function &putPixel(126, 127, 255,   0,   0, 255).
// 🟩 Green
Call the function &putPixel(127, 127,   0, 255,   0, 255).
// 🟦 Blue
Call the function &putPixel(128, 127,   0,   0, 255, 255).
// 🟥 Red
Call the function &putPixel(129, 127, 255,   0,   0, 255).
// 🟧 Dark Yellow (previous red + transparent green)
Call the function &putPixel(129, 127,   0, 255,   0, 127).

// ⬛ Black
Call the function &putPixel(126, 128,   0,   0,   0, 255).
// ⬜ White
Call the function &putPixel(127, 128, 255, 255, 255, 255).
// 🟥 Red
Call the function &putPixel(128, 128, 255,   0,   0, 255).
// 🟥 Dark pink (previous red + transparent blue)
Call the function &putPixel(128, 128,   0,   0, 255, 127).
// 🟦 Blue
Call the function &putPixel(129, 128,   0, 255,   0, 255).
// 🟦 Dark sea-blue (previous blue + transparent green)
Call the function &putPixel(129, 128,   0,   0, 255, 127).
\$\endgroup\$
0
0
\$\begingroup\$

JavaScript, 299 ... 257 252 bytes

Yeah... finally, the 256-bytes barrier was broken. This is improvement of kaya3 answer (329 bytes)

document.write`<canvas id=Y>`,c=Y.getContext`2d`
p=(x,y,a,...r)=>{c.fillStyle=`rgba(${r},${a/255})`;c.fillRect(x,y,1,1)}
(0x13112fb565921390e1525ad52e2debb235fdb48dc495b7b695e1605n+'')
.replace(/.{6}/g,x=>p(...[...x].map(u=>[0,126,127,128,129,255][u])))

Initialization & function: 120 bytes

Test-case code: 131 bytes (after remove one new-line character before last line)

Draw pixel explanation: we change BigInt hex num into long decimal string with 66 digits. We split long string into eleven 6-digit chunks and treat each digit as index. Then map each index to color value using array [0,126,127,128,129,255] and call put-pixel function p with parameters from such mapped chunk

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Save 4 bytes by calling functions as a tagged template \$\endgroup\$ Aug 8 at 19:06
  • \$\begingroup\$ @Samathingamajig thanks for advice! - answer updated \$\endgroup\$ Aug 8 at 19:12
  • 1
    \$\begingroup\$ nice work, JS below 256 bytes and a function that would work on different pixels as well. your should allow @kaya3 to work on his solution under the same conditions ;-) \$\endgroup\$
    – Joe85AC
    Aug 8 at 20:41

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.