Identicons are small images of geometric patterns that represent the hash value of a string. Stack Exchange uses the identicons from Gravatar as each user's default avatar image.
In this challenge, we will use the Gravatar identicons as well to generate some text to golf.
Challenge
This stack snippet (a minified version of this JSFiddle) lets you type in a string and gives back a 100×100 pixel black and white version of that string's identicon, along with a text version where 1
is for black and 0
is for white:
<!-- Click "Run code snippet" --> <div style='text-align:center;'> <input id='str' type='text' size='32' value='Python'> <button type='button' onclick='go()'>Go</button><br><br><input id='type1' name='type' type='radio' value='identicon' checked> <label for='type1'>Identicon</label> <input id='type2' name='type' type='radio' value='monsterid'> <label for='type2'>Monster</label> <input id='type3' name='type' type='radio' value='wavatar'> <label for='type3'>Wavatar</label> <input id='type4' name='type' type='radio' value='retro'> <label for='type4'>Retro</label> <br><br><a id='origLink'>original</a><br><canvas id='original' style='border:1px solid gray;'> Your browser does not support the canvas tag. </canvas> <br><br>binary<br><canvas id='binary' style='border:1px solid gray;'> </canvas> <br><br>text</br> <textarea id='text' style='background-color:#eee' readonly></textarea> <br><br>your text</br> <textarea id='userText'></textarea><br><button type='button' onclick='markDiffs()'>Mark Differences With X</button><br><br><span id='diffCount'></span> <br><br><small>(this snippet has only been tested in Chrome and Firefox)</small></div><script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script><script>function rgbDist(t,n){return Math.sqrt((Math.pow((t[0]-n[0])/255,2)+Math.pow((t[1]-n[1])/255,2)+Math.pow((t[2]-n[2])/255,2))/3)}function toBinImg(t,n){for(var r=0;r<t.data.length;r+=4){var e=rgbDist([t.data[r],t.data[r+1],t.data[r+2]],[255,255,255])<n;t.data[r]=t.data[r+1]=t.data[r+2]=e?255:0}}function getText(t){for(var n="",r=0,e=0;SIZE>e;e++){for(var o=0;SIZE>o;o++)n+=t.data[r]?"0":"1",r+=4;e!=SIZE-1&&(n+="\n")}return n}function markDiffs(){var t=0,n=$("#text").val().split("\n"),r=$("#userText").val(),e=new RegExp("(?:[01]{"+SIZE+"}\n){"+(SIZE-1)+"}(?:[01]{"+SIZE+"})\n?");if(!r.match(e))return void $("#diffCount").text("bad input");r=r.split("\n");for(var o="",a=0;SIZE>a;a++){for(var i=0;SIZE>i;i++)r[a][i]!==n[a][i]?(o+="X",t++):o+=r[a][i];o+="\n"}r[r.length-1].length&&(o=o.substring(0,o.length-1)),$("#diffCount").text(t+" differences found"),$("#userText").val(o)}function go(){var t=new Image;t.crossOrigin="anonymous",t.src="https://www.gravatar.com/avatar/"+md5($("#str").val())+"?&s="+SIZE+"&d="+$("input:radio[name=type]:checked").val(),$("#origLink").attr("href",t.src),t.onload=function(){ctxOrig.drawImage(t,0,0);var n=ctxOrig.getImageData(0,0,SIZE,SIZE);toBinImg(n,.05),$("#text").val(getText(n)),ctxBin.putImageData(n,0,0)}}var SIZE=100;$("#str").keyup(function(t){13==t.keyCode&&go()}),$("input[name=type]:radio").change(go),$(function(){var t=$("#original"),n=$("#binary");t.prop({width:SIZE,height:SIZE}),n.prop({width:SIZE,height:SIZE}),$("#text").prop({rows:SIZE+5,cols:SIZE+5}),$("#userText").prop({rows:SIZE+5,cols:SIZE+5}),ctxOrig=t[0].getContext("2d"),ctxBin=n[0].getContext("2d"),go()}),!function(t){"use strict";function n(t,n){var r=(65535&t)+(65535&n),e=(t>>16)+(n>>16)+(r>>16);return e<<16|65535&r}function r(t,n){return t<<n|t>>>32-n}function e(t,e,o,a,i,u){return n(r(n(n(e,t),n(a,u)),i),o)}function o(t,n,r,o,a,i,u){return e(n&r|~n&o,t,n,a,i,u)}function a(t,n,r,o,a,i,u){return e(n&o|r&~o,t,n,a,i,u)}function i(t,n,r,o,a,i,u){return e(n^r^o,t,n,a,i,u)}function u(t,n,r,o,a,i,u){return e(r^(n|~o),t,n,a,i,u)}function c(t,r){t[r>>5]|=128<<r%32,t[(r+64>>>9<<4)+14]=r;var e,c,f,g,d,h=1732584193,s=-271733879,v=-1732584194,I=271733878;for(e=0;e<t.length;e+=16)c=h,f=s,g=v,d=I,h=o(h,s,v,I,t[e],7,-680876936),I=o(I,h,s,v,t[e+1],12,-389564586),v=o(v,I,h,s,t[e+2],17,606105819),s=o(s,v,I,h,t[e+3],22,-1044525330),h=o(h,s,v,I,t[e+4],7,-176418897),I=o(I,h,s,v,t[e+5],12,1200080426),v=o(v,I,h,s,t[e+6],17,-1473231341),s=o(s,v,I,h,t[e+7],22,-45705983),h=o(h,s,v,I,t[e+8],7,1770035416),I=o(I,h,s,v,t[e+9],12,-1958414417),v=o(v,I,h,s,t[e+10],17,-42063),s=o(s,v,I,h,t[e+11],22,-1990404162),h=o(h,s,v,I,t[e+12],7,1804603682),I=o(I,h,s,v,t[e+13],12,-40341101),v=o(v,I,h,s,t[e+14],17,-1502002290),s=o(s,v,I,h,t[e+15],22,1236535329),h=a(h,s,v,I,t[e+1],5,-165796510),I=a(I,h,s,v,t[e+6],9,-1069501632),v=a(v,I,h,s,t[e+11],14,643717713),s=a(s,v,I,h,t[e],20,-373897302),h=a(h,s,v,I,t[e+5],5,-701558691),I=a(I,h,s,v,t[e+10],9,38016083),v=a(v,I,h,s,t[e+15],14,-660478335),s=a(s,v,I,h,t[e+4],20,-405537848),h=a(h,s,v,I,t[e+9],5,568446438),I=a(I,h,s,v,t[e+14],9,-1019803690),v=a(v,I,h,s,t[e+3],14,-187363961),s=a(s,v,I,h,t[e+8],20,1163531501),h=a(h,s,v,I,t[e+13],5,-1444681467),I=a(I,h,s,v,t[e+2],9,-51403784),v=a(v,I,h,s,t[e+7],14,1735328473),s=a(s,v,I,h,t[e+12],20,-1926607734),h=i(h,s,v,I,t[e+5],4,-378558),I=i(I,h,s,v,t[e+8],11,-2022574463),v=i(v,I,h,s,t[e+11],16,1839030562),s=i(s,v,I,h,t[e+14],23,-35309556),h=i(h,s,v,I,t[e+1],4,-1530992060),I=i(I,h,s,v,t[e+4],11,1272893353),v=i(v,I,h,s,t[e+7],16,-155497632),s=i(s,v,I,h,t[e+10],23,-1094730640),h=i(h,s,v,I,t[e+13],4,681279174),I=i(I,h,s,v,t[e],11,-358537222),v=i(v,I,h,s,t[e+3],16,-722521979),s=i(s,v,I,h,t[e+6],23,76029189),h=i(h,s,v,I,t[e+9],4,-640364487),I=i(I,h,s,v,t[e+12],11,-421815835),v=i(v,I,h,s,t[e+15],16,530742520),s=i(s,v,I,h,t[e+2],23,-995338651),h=u(h,s,v,I,t[e],6,-198630844),I=u(I,h,s,v,t[e+7],10,1126891415),v=u(v,I,h,s,t[e+14],15,-1416354905),s=u(s,v,I,h,t[e+5],21,-57434055),h=u(h,s,v,I,t[e+12],6,1700485571),I=u(I,h,s,v,t[e+3],10,-1894986606),v=u(v,I,h,s,t[e+10],15,-1051523),s=u(s,v,I,h,t[e+1],21,-2054922799),h=u(h,s,v,I,t[e+8],6,1873313359),I=u(I,h,s,v,t[e+15],10,-30611744),v=u(v,I,h,s,t[e+6],15,-1560198380),s=u(s,v,I,h,t[e+13],21,1309151649),h=u(h,s,v,I,t[e+4],6,-145523070),I=u(I,h,s,v,t[e+11],10,-1120210379),v=u(v,I,h,s,t[e+2],15,718787259),s=u(s,v,I,h,t[e+9],21,-343485551),h=n(h,c),s=n(s,f),v=n(v,g),I=n(I,d);return[h,s,v,I]}function f(t){var n,r="";for(n=0;n<32*t.length;n+=8)r+=String.fromCharCode(t[n>>5]>>>n%32&255);return r}function g(t){var n,r=[];for(r[(t.length>>2)-1]=void 0,n=0;n<r.length;n+=1)r[n]=0;for(n=0;n<8*t.length;n+=8)r[n>>5]|=(255&t.charCodeAt(n/8))<<n%32;return r}function d(t){return f(c(g(t),8*t.length))}function h(t,n){var r,e,o=g(t),a=[],i=[];for(a[15]=i[15]=void 0,o.length>16&&(o=c(o,8*t.length)),r=0;16>r;r+=1)a[r]=909522486^o[r],i[r]=1549556828^o[r];return e=c(a.concat(g(n)),512+8*n.length),f(c(i.concat(e),640))}function s(t){var n,r,e="0123456789abcdef",o="";for(r=0;r<t.length;r+=1)n=t.charCodeAt(r),o+=e.charAt(n>>>4&15)+e.charAt(15&n);return o}function v(t){return unescape(encodeURIComponent(t))}function I(t){return d(v(t))}function l(t){return s(I(t))}function p(t,n){return h(v(t),v(n))}function E(t,n){return s(p(t,n))}function S(t,n,r){return n?r?p(n,t):E(n,t):r?I(t):l(t)}"function"==typeof define&&define.amd?define(function(){return S}):t.md5=S}(this);//thanks https://github.com/blueimp/JavaScript-MD5/blob/master/js/md5.min.js</script>
(It also lets you load the Monster, Wavatar, and Retro Gravatar styles, but those are just for fun and aren't meant to be used for this challenge. Unicornicons are unfortunately missing due to XSS constraints. :/ )
Your task is to write a program that outputs the 100×100 character text block of 0
's and 1
's that is generated when you put your programming language's name into the snippet input box.
For example, if your submission is written in Python, you would type Python
into the stack snippet and see that
is the identicon for Python, and
is the black and white (binary) version, and
0000000000000000000000011111111111111111111111111100000000000000000000000010000000000000000000000000
0000000000000000000001111011111111111111111111111100000000000000000000011110000000000000000000000000
0000000000000000000111111011111111111111111111111100000000000000000001111110000000000000000000000000
0000000000000000011111111011111111111111111111111100000000000000000111111110000000000000000000000000
0000000000000001111111111001111111111111111111111100000000000000001111111110000000000000000000000000
0000000000000111111111111001111111111111111111111100000000000000111111111110000000000000000000000000
0000000000001111111111111000111111111111111111111100000000000111111111111110000000000000000000000000
0000000000000011111111111000111111111111111111111100000000011111111111111110000000000000000000000000
0000000000000000111111111000011111111111111111111100000001111111111111111110000000000000000000000000
0000000000000000001111111000001111111111111111111100000011111111111111111110000000000000000000000000
0000000000000000000011111000001111111111111111111100001111111111111111111110000000000000000000000000
0000000000000000000000111000000111111111111111111101111111111111111111111110000000000000000000000000
0000000000000000000000001000000111111111111111111111111111111111111111111110000001000000000001000000
0000000000000000000000111000000111111111111111111111111111111111111111111110000011000000000001100000
0000000000000000000011111000000011111111111111111111111111111111111111111110000011100000000011100000
0000000000000000001111111000000011111111111111111111111111111111111111111110000111100000000011110000
0000000000000000111111111000000001111111111111111111111111111111111111111110000111110000000111110000
0000000000000011111111111000000001111111111111111111111111111111111111111110001111110000000111111000
0000000000001111111111111000000000111111111111111111111111111111111111111110001111111000001111111000
0000000000000111111111111000000000011111111111111111111111111111111111111110011111111000001111111100
0000000000000001111111111000000000011111111111111111111111111111111111111110011111111100011111111100
0000000000000000011111111000000000001111111111111111111111111111111111111110111111111100011111111110
0000000000000000000111111000000000001111111111111111111111111111111111111110111111111110111111111110
0000000000000000000001111000000000001111111111111111111111111111111111111111111111111110111111111111
0000000000000000000000011000000000000111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000001
0111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000001111
0111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000111111
0111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000011111111
0011111111111111111111111000000000000000000000000000000000000000000000000000000000000000000111111111
0011111111111111111111111000000000000000000000000000000000000000000000000000000000000000011111111111
0001111111111111111111111000000000000000000000000000000000000000000000000000000000000011111111111111
0001111111111111111111111000000000000000000000000000000000000000000000000000000000001111111111111111
0000111111111111111111111000000000000000000000000000000000000000000000000000000000111111111111111111
0000011111111111111111111000000000000000000000000000000000000000000000000000000001111111111111111111
0000011111111111111111111000000000000000000000000000000000000000000000000000000111111111111111111111
0000001111111111111111111000000000000000000000000000000000000000000000000000111111111111111111111111
0000001111111111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000001111111111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000111111111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000111111111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000011111111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000011111111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000001111111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000000111111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000000111111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000000011111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000000011111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000000011111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
0000000000001111111111111000000000000000000000000000000000000000000000000001111111111111111111111111
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111000000000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111100000000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111100000000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111110000000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111110000000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111111000000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111111000000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111111100000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111111100000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111111110000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111111110000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111111111000000
1111111111111111111111111000000000000000000000000000000000000000000000000001111111111111111111000000
1111111111111111111111110000000000000000000000000000000000000000000000000001111111111111111111100000
1111111111111111111111000000000000000000000000000000000000000000000000000001111111111111111111100000
1111111111111111111100000000000000000000000000000000000000000000000000000001111111111111111111110000
1111111111111111110000000000000000000000000000000000000000000000000000000001111111111111111111110000
1111111111111111000000000000000000000000000000000000000000000000000000000001111111111111111111111000
1111111111111100000000000000000000000000000000000000000000000000000000000001111111111111111111111000
1111111111110000000000000000000000000000000000000000000000000000000000000001111111111111111111111100
1111111111000000000000000000000000000000000000000000000000000000000000000001111111111111111111111100
1111111100000000000000000000000000000000000000000000000000000000000000000001111111111111111111111110
1111110000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111110
1111000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111
1100000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111110000000000001100000000000000000000000
1111111111111111111111111111111111111111111111111111111111111111000000000001111000000000000000000000
0111111111110111111111111111111111111111111111111111111111111111000000000001111110000000000000000000
0111111111110011111111110111111111111111111111111111111111111111100000000001111111100000000000000000
0011111111100011111111110111111111111111111111111111111111111111100000000001111111111000000000000000
0011111111000001111111100111111111111111111111111111111111111111110000000001111111111110000000000000
0001111111000001111111100111111111111111111111111111111111111111110000000001111111111111000000000000
0001111111000000111111000111111111111111111111111111111111111111111000000001111111111100000000000000
0000111110000000111111000111111111111111111111111111111111111111111000000001111111110000000000000000
0000111110000000011110000111111111111111111111111111111111111111111100000001111111000000000000000000
0000011100000000011100000111111111111111111111111111111111111111111100000001111100000000000000000000
0000011100000000001100000111111111111111111111111111111111111111111110000001110000000000000000000000
0000001000000000001100000111111111111111111111111111111111111111111110000001000000000000000000000000
0000000000000000000000000111111111111111111111111011111111111111111111000001110000000000000000000000
0000000000000000000000000111111111111111111111100011111111111111111111000001111100000000000000000000
0000000000000000000000000111111111111111111110000011111111111111111111100001111111000000000000000000
0000000000000000000000000111111111111111111000000011111111111111111111100001111111110000000000000000
0000000000000000000000000111111111111111100000000011111111111111111111110001111111111100000000000000
0000000000000000000000000111111111111110000000000011111111111111111111110001111111111111000000000000
0000000000000000000000000111111111111000000000000011111111111111111111111001111111111110000000000000
0000000000000000000000000111111111100000000000000011111111111111111111111001111111111000000000000000
0000000000000000000000000111111110000000000000000011111111111111111111111101111111100000000000000000
0000000000000000000000000111111000000000000000000011111111111111111111111101111110000000000000000000
0000000000000000000000000111100000000000000000000011111111111111111111111111111000000000000000000000
0000000000000000000000000110000000000000000000000011111111111111111111111111100000000000000000000000
is the corresponding textual output that your Python program must produce.
However, since identicons can have a lot of awkward angles and their rasterization as a black and white image can leave jaggies, your output is allowed to have up to 300 0
's or 1
's that are the opposites of what they are supposed to be. (That's 3% of the 10000 total 0
's and 1
's.)
Near the bottom of the snippet, you can paste in the output of your program and check how many 0
's or 1
's are different than what they should be. Any number of differences at or below 300 is valid.
Scoring
The submission with the fewest bytes wins. (Handy byte counter.)
Tiebreaker goes to the submission with the fewest incorrect 0
's and 1
's.
If there's still a tie, the earlier submission wins.
Details
- Output goes to stdout or a similar alternative if your language does not have stdout.
- The output may optionally have a trailing newline.
- Please include the color identicon image in your post along with the exact string that generates it. There's no need to waste space and post your entire textual output.
- Your program should run without an internet connection. You need to generate the text in your code, not query it from the Gravatar site.
- Use common sense when "naming" your language. Use the language name you would normally use on this site. Don't be annoying and contrive a name that makes the identicon easy to golf. e.g.
Python 2
is fine for Python butpython 2.7.2
is stretching it andpython 2.7.2 by Guido van Rossum
would be ridiculous. - I realize some languages are inherently easier than others because their identicon shapes are simpler. That's just the way it's gonna be, don't get too disgruntled or competitive about that. ;)