58
\$\begingroup\$

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

Python identicon

is the identicon for Python, and

binary Python identicon

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 but python 2.7.2 is stretching it and python 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. ;)
\$\endgroup\$
  • \$\begingroup\$ Is there some kind of formula for generating identicons? Wouldn't it be quite long to write a script to generate them? \$\endgroup\$ – Zach Gates May 3 '15 at 5:00
  • \$\begingroup\$ @ZachGates Well you only need to generate one, namely the one for your language. They have a lot of symmetry so it shouldn't be too bad. \$\endgroup\$ – Calvin's Hobbies May 3 '15 at 5:01
  • 7
    \$\begingroup\$ I dare someone to do "GNU E". \$\endgroup\$ – Sp3000 May 3 '15 at 7:18
  • 2
    \$\begingroup\$ I think there should be a bonus for having no errors. Basically because both my answers have none! \$\endgroup\$ – CJ Dennis May 6 '15 at 12:15
  • 2
    \$\begingroup\$ @CJDennis That would increase the bias towards having nice identicons though, because some identicons aren't perfectly symmetrical due to jaggies as stated in the question. \$\endgroup\$ – Sp3000 May 8 '15 at 2:32

27 Answers 27

31
\$\begingroup\$

CJam, 92 81 79 71 bytes, 120 errors

Identicon

25:M{'0*MXe[}%2/z:~M,_ff{_)2$)d/2mLz1>@@+38<^}:A.+AM'1*f++_W%z.+N*N1$W%

There is probably still some room to golf this.

Test it here.

Explanation

I'm not using any compression, but instead I actually compute the individual tiles and piece the result together from those. The top-left tile is intentionally approximated. A few other errors result from the binarised image not being fully rotationally symmetric. Let's go through the code.

The first tile should theoretically look like this:

1111111111111111111111111
1111111111111111111111100
1111111111111111111110000
1111111111111111111000000
1111111111111111100000000
1111111111111110000000000
1111111111111000000000000
1111111111100000000000000
1111111110000000000000000
1111111000000000000000000
1111100000000000000000000
1110000000000000000000000
1111111111111111111111111
1111111111111111111111110
1111111111111111111111000
1111111111111111111100000
1111111111111111110000000
1111111111111111000000000
1111111111111100000000000
1111111111110000000000000
1111111111000000000000000
1111111100000000000000000
1111110000000000000000000
1111000000000000000000000
1100000000000000000000000

That's 12 lines, then 13 lines of the point between 1s and 0s decreasing by 2 at a time. Notice that the first block has an even number of 0s and the second block an odd number. We can make the pattern even more regular if we sacrifice accuracy on the middle row and turn it into 1 followed by 24 0s. Then we actually have one row for each number of zeroes from 0 to 24, alternating between the top and bottom parts. So we can just generate them in order (as a single triangle), and then pull out every other line:

25:M{'0*MXe[}%2/z:~
25:M                e# Push 25 and store it in M for future use.
    {       }%      e# Map this block onto the range [0 ... 24].
     '0*            e# Create a string of i zeroes.
        MXe[        e# Pad to width 25 with 1s from the left.
              2/    e# Group the lines into pairs.
                z   e# Zip the pairs, thereby grouping even and odd lines.
                 :~ e# Flatten the two groups so we've got a plain 2D grid again.

Next up is that fancy triangle to the right of this tile:

1100000000000000000000000
1111000000000000000000000
0111110000000000000000000
0111111100000000000000000
0011111111000000000000000
0011111111110000000000000
0001111111111100000000000
0001111111111111000000000
0000111111111111110000000
0000111111111111111100000
0000011111111111111111000
0000011111111111111111110
0000001111111111111111111
0000001111111111111111111
0000000111111111111111110
0000000111111111111111100
0000000011111111111111000
0000000011111111111110000
0000000001111111111100000
0000000001111111111000000
0000000000111111110000000
0000000000111111100000000
0000000000011111000000000
0000000000011110000000000
0000000000001100000000000

If we consider a coordinate system with origin in the top right corner and x going right and y going down, then the region of 1s satisfies 3 inequalities: x/y ≥ 1/2, x/y ≥ 2, x + y < 38. We can just compute these separately and take the logical end. It doesn't save any characters but cleans up the code slightly if we combine the first two inequalities though:

    1/2 ≤ x/y ≤ 2
=>  -1 ≤ log2(x/y) ≤ 1
=>  |log2(x/y)| ≤ 1

Ultimately, we'll save another byte by checking the opposite and using xor instead of and to combine the result with the other inequality:

M,_ff{_)2$)d/2mLz1>@@+38<^}
M,_                         e# Create a range [0 .. 24] and duplicate it.
   ff{                    } e# This creates a 25x25 array, where each element is 
                            e# determined by executing the block on the pair of its
                            e# x and y coordinates.
      _)                    e# Copy x and increment.
        2$)                 e# Copy y and increment.
           d/               e# Convert to double and divide.
             2mL            e# Get base-2 logarithm.
                z1>         e# Take modulus and check if it's greater than 1.
                   @@       e# Get the other two copies of x and y.
                     +38<   e# Add them and check that they are less than 38.
                         ^  e# Take the XOR with the other condition.

We've got everything in place now - the remaining tiles are just copies and rotations of these, as well as the solid (boring) tile in the centre. So let's pull everything together:

:A.+AM'1*f++_W%z.+N*N1$W%
:A                         e# Store the fancy triangle in A.
  .+                       e# Join the two existing tiles horizontally.
    A                      e# Push the triangle again.
     M'1*                  e# Create a string of 25 ones.
         f+                e# Add it to each line of the triangle.
           +               e# Add these two tiles to the first two tiles, completing
                           e# the upper left quadrant.
            _W%z           e# Duplicate the quadrant, reverse the rows, transpose.
                           e# These two operations together perform a 90 degree
                           e# clockwise rotation.
                .+         e# Join the two quadrants horizontally.
                  N*       e# Join the lines together with newline characters.
                    N1$    e# Push a newline to separate the two halves and copy the
                           e# first half.
                       W%  e# Reverse the entire string. Since this reverse the string
                           e# both vertically and horizontally, this rotates the
                           e# half by 180 degrees.

At the end of the program, CJam simply prints the stack contents back-to-back, creating the desired result.

\$\endgroup\$
40
\$\begingroup\$

Octave 166 164 bytes, 0 errors

Octave has a great stength in handling/building matrices. For the 'diamonds' I made an x-y-coordinate system and used manhattan norm for deciding whether the entries will be 1 or 0. As the diamonds are not fully symmetrical, I had to fiddle around with the 'distance' and the centerpoint, so with the center point (13.1,13.1) it worked for both kinds of 'diamond' shapes.

After that I could just set one quarter of those to zero in order to get those C-shapes. The squares and the matrix concatenation were easy.

New Version -2 characters (works the same way as the old, but I managed to abuse the Octave syntax even somewhat more:

C=ones(25);M=(R=(R=meshgrid(abs(-12.1:12)))+R')>12|R<6.5;S=T=U=V=13.1>R&R>5.8;C(k=8:19,k)=S(f,s)=T(f,f)=U(s,f=1:12)=V(s=14:25,s)=0;[C,U,T,C;U,M,M,T;V,M,M,S;C,V,S,C]

Old version:

C=ones(25);                               %corner squares
C(k=8:19,k)=0;                            %set the inner squares to 0
X=meshgrid(abs(-12.1:12));                %build coordinate system
R=X+X';                                   %R already has the distances to the chosen centerpoint (13.1, 13.1)
M=R>12|R<6.5;                             %diamond (for the center)
S=T=U=V=13.1>R&R>5.8;                     %diamond (for the edges)
S(f,s)=T(f,f)=U(s,f=1:12)=V(s=14:25,s)=0; %set each one quarter to 0 for the C-shape
[C,U,T,C;U,M,M,T;V,M,M,S;C,V,S,C]         %concatenate and display the big matrix

Output

enter image description here

1111111111111111111111111000000000000110000000000000000000000011000000000001111111111111111111111111
1111111111111111111111111000000000001111000000000000000000000011100000000001111111111111111111111111
1111111111111111111111111000000000011111100000000000000000000011110000000001111111111111111111111111
1111111111111111111111111000000000111111110000000000000000000011111000000001111111111111111111111111
1111111111111111111111111000000001111111111000000000000000000011111100000001111111111111111111111111
1111111111111111111111111000000011111111111100000000000000000011111110000001111111111111111111111111
1111111111111111111111111000000111111111111110000000000000000011111111000001111111111111111111111111
1111111000000000000111111000001111111011111111000000000000000001111111100001111111000000000000111111
1111111000000000000111111000011111110001111111100000000000000000111111110001111111000000000000111111
1111111000000000000111111000111111100000111111110000000000000000011111111001111111000000000000111111
1111111000000000000111111001111111000000011111111000000000000000001111111101111111000000000000111111
1111111000000000000111111011111110000000001111111100000000000000000111111111111111000000000000111111
1111111000000000000111111111111100000000000111111111111110000000000011111111111111000000000000111111
1111111000000000000111111000000000000000001111111111111111000000000111111111111111000000000000111111
1111111000000000000111111000000000000000011111111001111111100000001111111101111111000000000000111111
1111111000000000000111111000000000000000111111110000111111110000011111111001111111000000000000111111
1111111000000000000111111000000000000001111111100000011111111000111111110001111111000000000000111111
1111111000000000000111111000000000000011111111000000001111111101111111100001111111000000000000111111
1111111000000000000111111000000000000111111110000000000111111111111111000001111111000000000000111111
1111111111111111111111111000000000000111111100000000000011111111111110000001111111111111111111111111
1111111111111111111111111000000000000111111000000000000001111111111100000001111111111111111111111111
1111111111111111111111111000000000000111110000000000000000111111111000000001111111111111111111111111
1111111111111111111111111000000000000111100000000000000000011111110000000001111111111111111111111111
1111111111111111111111111000000000000111000000000000000000001111100000000001111111111111111111111111
1111111111111111111111111000000000000110000000000000000000000111000000000001111111111111111111111111
0000000000001100000000000111111111111111111111111111111111111111111111111110000000000001100000000000
0000000000011110000000000111111111111001111111111111111111111100111111111110000000000001110000000000
0000000000111111000000000111111111110000111111111111111111111000011111111110000000000001111000000000
0000000001111111100000000111111111100000011111111111111111110000001111111110000000000001111100000000
0000000011111111110000000111111111000000001111111111111111100000000111111110000000000001111110000000
0000000111111111111000000111111110000000000111111111111111000000000011111110000000000001111111000000
0000001111111111111100000111111100000100000011111111111110000010000001111110000000000001111111100000
0000011111110111111110000111111000001110000001111111111100000111000000111110000000000000111111110000
0000111111100011111111000111110000011111000000111111111000001111100000011110000000000000011111111000
0001111111000001111111100111100000111111100000011111110000011111110000001110000000000000001111111100
0011111110000000111111110111000001111111110000001111100000111111111000000110000000000000000111111110
0111111100000000011111111110000011111111111000000111000001111111111100000010000000000000000011111111
1111111000000000001111111100000111111111111100000010000011111111111110000001111111000000000001111111
0000000000000000011111111100000011111111111000000110000001111111111100000011111111100000000011111111
0000000000000000111111110110000001111111110000001111000000111111111000000110111111110000000111111110
0000000000000001111111100111000000111111100000011111100000011111110000001110011111111000001111111100
0000000000000011111111000111100000011111000000111111110000001111100000011110001111111100011111111000
0000000000000111111110000111110000001110000001111111111000000111000000111110000111111110111111110000
0000000000001111111100000111111000000100000011111111111100000010000001111110000011111111111111100000
0000000000001111111000000111111100000000000111111111111110000000000011111110000001111111111111000000
0000000000001111110000000111111110000000001111111111111111000000000111111110000000111111111110000000
0000000000001111100000000111111111000000011111111111111111100000001111111110000000011111111100000000
0000000000001111000000000111111111100000111111111111111111110000011111111110000000001111111000000000
0000000000001110000000000111111111110001111111111111111111111000111111111110000000000111110000000000
0000000000001100000000000111111111111011111111111111111111111101111111111110000000000011100000000000
0000000000001100000000000111111111111111111111111111111111111111111111111110000000000001000000000000
0000000000011110000000000111111111111001111111111111111111111100111111111110000000000011000000000000
0000000000111111000000000111111111110000111111111111111111111000011111111110000000000111000000000000
0000000001111111100000000111111111100000011111111111111111110000001111111110000000001111000000000000
0000000011111111110000000111111111000000001111111111111111100000000111111110000000011111000000000000
0000000111111111111000000111111110000000000111111111111111000000000011111110000000111111000000000000
0000001111111111111100000111111100000100000011111111111110000010000001111110000001111111000000000000
0000011111110111111110000111111000001110000001111111111100000111000000111110000011111110000000000000
0000111111100011111111000111110000011111000000111111111000001111100000011110000111111100000000000000
0001111111000001111111100111100000111111100000011111110000011111110000001110001111111000000000000000
0011111110000000111111110111000001111111110000001111100000111111111000000110011111110000000000000000
0111111100000000011111111110000011111111111000000111000001111111111100000010111111100000000000000000
1111111000000000001111111100000111111111111100000010000011111111111110000001111111000000000001111111
1111111100000000000000000100000011111111111000000110000001111111111100000011111111100000000011111111
0111111110000000000000000110000001111111110000001111000000111111111000000110111111110000000111111110
0011111111000000000000000111000000111111100000011111100000011111110000001110011111111000001111111100
0001111111100000000000000111100000011111000000111111110000001111100000011110001111111100011111111000
0000111111110000000000000111110000001110000001111111111000000111000000111110000111111110111111110000
0000011111111000000000000111111000000100000011111111111100000010000001111110000011111111111111100000
0000001111111000000000000111111100000000000111111111111110000000000011111110000001111111111111000000
0000000111111000000000000111111110000000001111111111111111000000000111111110000000111111111110000000
0000000011111000000000000111111111000000011111111111111111100000001111111110000000011111111100000000
0000000001111000000000000111111111100000111111111111111111110000011111111110000000001111111000000000
0000000000111000000000000111111111110001111111111111111111111000111111111110000000000111110000000000
0000000000011000000000000111111111111011111111111111111111111101111111111110000000000011100000000000
1111111111111111111111111000000000000110000000000000000000000010000000000001111111111111111111111111
1111111111111111111111111000000000001111000000000000000000000110000000000001111111111111111111111111
1111111111111111111111111000000000011111100000000000000000001110000000000001111111111111111111111111
1111111111111111111111111000000000111111110000000000000000011110000000000001111111111111111111111111
1111111111111111111111111000000001111111111000000000000000111110000000000001111111111111111111111111
1111111111111111111111111000000011111111111100000000000001111110000000000001111111111111111111111111
1111111111111111111111111000000111111111111110000000000011111110000000000001111111111111111111111111
1111111000000000000111111000001111111011111111000000000111111100000000000001111111000000000000111111
1111111000000000000111111000011111110001111111100000001111111000000000000001111111000000000000111111
1111111000000000000111111000111111100000111111110000011111110000000000000001111111000000000000111111
1111111000000000000111111001111111000000011111111000111111100000000000000001111111000000000000111111
1111111000000000000111111011111110000000001111111101111111000000000000000001111111000000000000111111
1111111000000000000111111111111100000000000111111111111110000000000011111111111111000000000000111111
1111111000000000000111111111111110000000000000000011111111000000000111111111111111000000000000111111
1111111000000000000111111011111111000000000000000001111111100000001111111101111111000000000000111111
1111111000000000000111111001111111100000000000000000111111110000011111111001111111000000000000111111
1111111000000000000111111000111111110000000000000000011111111000111111110001111111000000000000111111
1111111000000000000111111000011111111000000000000000001111111101111111100001111111000000000000111111
1111111000000000000111111000001111111100000000000000000111111111111111000001111111000000000000111111
1111111111111111111111111000000111111100000000000000000011111111111110000001111111111111111111111111
1111111111111111111111111000000011111100000000000000000001111111111100000001111111111111111111111111
1111111111111111111111111000000001111100000000000000000000111111111000000001111111111111111111111111
1111111111111111111111111000000000111100000000000000000000011111110000000001111111111111111111111111
1111111111111111111111111000000000011100000000000000000000001111100000000001111111111111111111111111
1111111111111111111111111000000000001100000000000000000000000111000000000001111111111111111111111111
\$\endgroup\$
  • \$\begingroup\$ It's so pretty, it actually made me look into what Octave is about. \$\endgroup\$ – Marc Dingena May 4 '15 at 9:16
  • \$\begingroup\$ Thanks, that's nice to hear=) (Welcome on codegolf.SE by the way!) If you're interested in calculations with matrices this is definitely worth looking into! \$\endgroup\$ – flawr May 4 '15 at 20:36
23
\$\begingroup\$

Brainfuck 9418 2237 bytes, 88 errors

Edit: As mbomb007 pointed out the 'official' name seems to not be capitalized, this is not mentioned on wikipedia, but is on esolangs. This annoys me, but not nearly enough to redo this ;).

My first Brainfuck program!

Now actually uses math and logic and stuff! (for every pixel it decides 0 or 1 depending on a few conditionals). This was quite fun to do; that being said I don't think I'm going to code again with Brainfuck for a long long time.

>>>++[<+>+++++]<-->>++[<+>+++++]<--[->+++++[>+++++<-]<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[-<+>]<+<[->>>>>>>+<<<<<<<]>>>>>>>->+++++[>+++++<-]<[->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]>[-<<<<<<<<+>>>>>>>>]<<<<<<<<+>>>>>>+>>>>>>+<<<<<<[>>+++<<<[>>>-<+<<-]>>[<<+>>-]>[<<->>[-]]<<<[->>+<<]>+>[<->[-<<+>>]]>>>>>]<<<<<<[-<<<<<<+>>>>>>]<<<<<+<[-[->-<>>>>[->>>+>>>>>>>++>>>>>>>>>>>>>>>>>+>>>>>>>++<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]<[->>>>>>>>>>>>>>>>+>>>>>>>++>>>>>>>>>>>>>>>>>+>>>>>>>++<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]<<<<<[->>>>>>>>>>++>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>++>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]<[->>>>>>>>>>>>>>>>>>>>>>>++>>>>>+>>>>>>>++>>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<]>>>>>>>>>>>+>>>+>>>+>>>+>>>>>>+>>+>>>>+>>++>>>>+>>>++>>>+>>>++>>>+>>++>>>>+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<[<<<[>+>+<<-]>>[<<+>>-]<<<[>>>+<<<-]>>>[>-]>[<<<<+>>[-]>>->]<+<<[>-[>-]>[<<<<+>>[-]+>>->]<+<<-]>>[-]<[-]<<[-]>>>>>>>>>]<<<<<<<<<<[<<<<<<[<<<<<<[<<<<<<[<+>-]>>>>>>-]>>>>>>-]>>>>>>-]<<<<<<[-]<<<<<<[-]<<<<<<[-]<<<<<<[<<<<<<[<<<<<<[<<<<<<[<+>-]>>>>>>-]>>>>>>-]>>>>>>-]<<<<<<[-]<<<<<<[-]<<<<<<[-]>>>>>>>>>>>>>>>>>>>>>>>[-<<<<<<<<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>>>>>>>>]<<<<<<<<<<<<<<<<<<<<<<<<[<<<<<<<<<<<<<+>>>>>>>>>>>>>[-]]<[-]<<<<<<[-]>]>[-<<[[->+<]>-<]>[<<[-]<[->+<]>->>[-]]>>>>>[[->+<]>-<]>[<<[-]<[->+<]->->>[-]]>>>+>>>>++[<++>+++++++]>>+<<<<<<<<<<+<[->+<<<<<++>>>>>>>>>>>+<<<<<<<]<[-]+<<<<+<[->+>>>>>>>++>>>>>+<<<<<<<<<<<<<]>>>>>[<<<[>+>+<<-]>>[<<+>>-]<<<[>>>+<<<-]>>>[>-]>[<<<<+>>[-]>>->]<+<<[>-[>-]>[<<<<+>>[-]+>>->]<+<<-]>>[-]<[-]<<[-]>>>>>>>>>]<<<<<<<<<<[-<<<<<<+>>>>>>]<<<<<<[-<<<<<<+>>>>>>]<<<<<<<+++>[-<->]<[<<<<<+>>>>>[-]]<[-]>>>]<]>[-<<<[->>>>>+>+<<<<<<]>>>>>[->>>>>>>>>>>>>>>+>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<]>[->>+>>>>>>>+<<<<<<<<<]>>>>++++[<++++>-]<+>>>+>+++++[>++++++<-]>>>>>+>>>>+++[<++++++>-]<+>>>+>+++++[>++++++<-]>+>>>>+[<<<[>+>+<<-]>>[<<+>>-]<<<[>>>+<<<-]>>>[>-]>[<<<<+>>[-]>>->]<+<<[>-[>-]>[<<<<+>>[-]+>>->]<+<<-]>>[-]<[-]<<[-]<<<]>>>>>>>>>>>>>>>>>>>>[-<<<<<<+>>>>>>]<<<<<<[-<<<<<<+>>>>>>]<<<<<<[-<<<<<<+>>>>>>]<<<<<<[-<<<<<<<<<<<<<+>>>>>>>>>>>>>[-]]<[-]<<<<<<[-]<<[-]>>>]<<<<<<<<<+[>+<+++++]>---.[-]>-[->>+<<]>>>+<[>-<[-<<+>>]]>[<<->++[<<+>>+++++]<<-->>>[-]++++++++++.[-]]<<]

producing the bitmap of the image:

enter image description here

A version with some comments (might not be very useful as they were mostly for my own benefit):

>>
>++[<+>+++++]<--
>
>++[<+>+++++]<--            100 100     x y range from 1 to 100 (min is not 0) 

[                                           while y
    -                                           x       * y_1
    >+++++[>+++++<-]<
    [->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]           x       * 0     y_1     25_(y_1)%25     (y_1)%25    y//25
    >[-<+>]<+                                   x       * y     0       25_(y_1)%25     (y_1)%25    y//25
    <[->>>>>>>+<<<<<<<]>>>>>>>-                 0       y       0       25_(y_1)%25     (y_1)%25    y//25       0           * x_1
    >+++++[>+++++<-]<
    [->+>-[>+>>]>[+[-<+>]>+>>]<<<<<<]           0       y       0       25_(y_1)%25     (y_1)%25    y//25       0           * 0     x_1     25_(x_1)%25     (x_1)%25    x//25
    >[-<<<<<<<<+>>>>>>>>]<<<<<<<<+              * x     y       0       25_(y_1)%25     (y_1)%25    y//25       0           0       0       25_(x_1)%25     (x_1)%25    x//25

    >>>>>>+>>>>>>+<<<<<<
    [
        >>+++<<
        <[>>>-<+<<-]
        >>[<<+>>-]
        >[<<->>[-]]                             x       y       0       25_(y_1)%25     (y_1)%25    y//25       y//25=3     0       * 0     25_(x_1)%25     (x_1)%25    x//25

        <<<[->>+<<]
        >+>
        [<->[-<<+>>]]                           x       y       0       25_(y_1)%25     (y_1)%25    y//25       y//25=0|3   *0      0       25_(x_1)%25     (x_1)%25    x//25

        >>>>>
    ]
    <<<<<<                                      x       y       0       25_(y_1)%25     (y_1)%25    y//25       y//25=0|3   0       0       25_(x_1)%25     (x_1)%25    x//25       * x//25=0|3
    [-<<<<<<+>>>>>>]                            x       y       0       25_(y_1)%25     (y_1)%25    y//25       p           0       0       25_(x_1)%25     (x_1)%25    x//25       * 0
    <<<<<

    +<
    [
        -
        [   
            ->-<

            ### p == 2 ###                      x       y       0       v1              v0          y//25       0           * 0     0       u1              u0          x//25       0

            >>>>
            [->>>+ >>>>>>>++ >>>>>>>>>>>>>>>>>+ >>>>>>>++<<<<<<< <<<<<<<<<<<<<<<<< <<<<<<< <<<]
            <
            [->>>>>>>>>>>>>>>>+ >>>>>>>++ >>>>>>>>>>>>>>>>>+ >>>>>>>++ <<<<<<< <<<<<<<<<<<<<<<<< <<<<<<< <<<<<<<<<<<<<<<<]
            <<<<<
            [->>>>>>>>>>++ >>>>>+ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>++ >>>>>+ <<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<< <<<<<<<<<<]
            <
            [->>>>>>>>>>>>>>>>>>>>>>>++ >>>>>+ >>>>>>>++ >>>>>+ <<<<< <<<<<<< <<<<< <<<<<<<<<<<<<<<<<<<<<<<]

            >>>>>>>>
            >>>+
            >>>+>>>+
            >>>+>>>
            >>>+>>+>
            >>>+>>++>
            >>>+>>>++
            >>>+>>>++
            >>>+>>++>
            >>>+<<<
            <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                                                x       y       0       0               0           y//25       0           0       0       0               0           x//25       * 0
            [
                <
                <<[>+>+<<-]
                >>[<<+>>-]
                <<<[>>>+<<<-]
                >>>[>-]> [< <<<+ >>[-] > >->]<+<
                <[>- [>-]> [< <<<+ >>[-]+ > >->]<+< <-]
                >>[-]<[-]<<[-]>>>>>>>>>
            ]

            <<<<<<<<<<
            [<<<<<<[<<<<<<[<<<<<<[<+>-]>>>>>>-]>>>>>>-]>>>>>>-]
            <<<<<<[-]<<<<<<[-]<<<<<<[-]
            <<<<<<
            [<<<<<<[<<<<<<[<<<<<<[<+>-]>>>>>>-]>>>>>>-]>>>>>>-]
            <<<<<<[-]<<<<<<[-]<<<<<<[-]
            >>>>>> >>>>>> >>>>>> >>>>>
            [-<<<<<< <<<<<< <<<<<< <<<<<< + >>>>>> >>>>>> >>>>>> >>>>>>]
            <<<<<< <<<<<< <<<<<< <<<<<<
            [<<<<<<<<<<<<<+>>>>>>>>>>>>>[-]]
            <[-]<<<<<<[-]>
        ]
        >
        [
            -
            ### p == 1 ###                      x       y       0       v1              v0          y//25       0           * 0     0       u1              u0          x//25       0
            <<
            [
                [->+<]
                >-<
            ]
            >
            [
                <<[-]<[->+<]
                >->>[-]
            ]                                   x       y       0       ~               v           0           * 0         0       0       u1              u0          x//25       0
            >>>>>
            [
                [->+<]
                >-<
            ]
            >
            [
                <<[-]<[->+<]-
                >->>[-]
            ]                                   x       y       0       ~               v           0           0           0       0       ~               u           0           * 0
            >>>+>>>
            >++[<++>+++++++]
            >>+<<<
            <<<<<<<+<
            [->+<<<<<++>>>> >>>>>>>+<<<<<<<]
            <[-]+<<<<+<
            [->+>>>>>>>++>>>>>+<<<<<<<<<<<<<]   x       y       0       ~               * 0         v           2u_1        0       0       ~               0           u           2v_1
            >>>>>

            [
                <
                <<[>+>+<<-]
                >>[<<+>>-]
                <<<[>>>+<<<-]
                >>>[>-]> [< <<<+ >>[-] > >->]<+<
                <[>- [>-]> [< <<<+ >>[-]+ > >->]<+< <-]
                >>[-]<[-]<<[-]>>>>>>>>>
            ]                                   
            <<<<<<<<<<                          x       y       0       ~               0           v~2u_1      0           0       0       0               0           u~2v_1      0
            [-<<<<<<+>>>>>>]<<<<<<
            [-<<<<<<+>>>>>>]<<<<<<
            <+++>
            [-<->]
            <[<<<<<+>>>>>[-]]
            <[-]>>>
        ]
        <
    ]
    >
    [
        -
        ### p = 0 ###
                                                x       y       0       v1              v0          y//25       p           * 0     0       u1              u0          x//25

        <<<[->>>>>+>+<<<<<<]                    x       y       0       v1              * 0         y//25       p           0       0       v0|u1           v0|u0       x//25
        >>>>>
        [->>>>>>>>>>>>>>>+>>>>>>>+<<<<<<<<<<<<<<<<<<<<<<]               x       y       0       v1              0           y//25       p           0       0       * 0             v0|u0       x//25       x y t0 t1 _ _  x y t0 t1 _ _  x y t0 t1 _ _ x y t0 t1 _ _
        >[->>+>>>>>>>+<<<<<<<<<]                                        x       y       0       v1              0           y//25       p           0       0       0               *0          x//25       x y t0 t1 _ _  x y t0 t1 _ _  x y t0 t1 _ _ x y t0 t1 _ _
        >>>>++++[<++++>-]<+
        >>>+
        >+++++[>++++++<-]>
        >>>>+
        >>>>+++[<++++++>-]<+
        >>>+
        >+++++[>++++++<-]>+
        >>>>+
        [
            <
            <<[>+>+<<-]
            >>[<<+>>-]
            <<<[>>>+<<<-]
            >>>[>-]> [< <<<+ >>[-] > >->]<+<
            <[>- [>-]> [< <<<+ >>[-]+ > >->]<+< <-]
            >>[-]<[-]<<[-]<<<
        ]
        >>
        >>>>>>
        >>>>>>
        >>>>>>
        [-<<<<<<+>>>>>>]<<<<<<
        [-<<<<<<+>>>>>>]<<<<<<
        [-<<<<<<+>>>>>>]<<<<<<
        [-<<<<<<<<<<<<<+>>>>>>>>>>>>>[-]]                               x       y       0       v1              0           y//25       p           0       0       0               0           x//25       *0

        <[-]<<<<<<[-]<<[-]
        >>>
    ]

    <
    <<<<<
    <<<
    +[>+<+++++]>---.[-]

    >
    -                                           decrement x
    [->>+<<]>>>+<
    [
        >-<
        [-<<+>>]
    ]
    >
    [                                           if x is 0
        <<-                                     decrement y
        >++[<<+>>+++++]<<--                     set x to 100
        >>>[-]
        ++++++++++.                             output '/n'
        [-]
    ]
    <<
]
\$\endgroup\$
  • 1
    \$\begingroup\$ I think this is actually incorrect, because the language's name isn't capitalized (though people often do anyway), so the identicon would be different. \$\endgroup\$ – mbomb007 Mar 16 '16 at 18:55
19
\$\begingroup\$

Python, 294 273 239 188 179 170 159 154 bytes

Here is the 158-byte version:

I=100*[100*"0"]
for j in range(7500):i=j%25;j/=100;I=map(list,zip(*I[::-1]));I[i][j]=`+[abs(i%12-6)+5<j/2,j>i/2+24,2*i>72-j][j/25]`
for r in I:print"".join(r)

This is a Python 2 only program, but I'm using the identicon for "Python" (i.e. the one in the OP). The diff should be 78 bits.

By throwing accuracy out the door, here is the 154-byte version:

I=100*[100*"0"]
for j in range(7425):i=j%25;j/=99;I=map(list,zip(*I[::-1]));I[i][j]=`+[~i%12<j/2>i%12,j>i/2+24,2*i>72-j][j/25]`
for r in I:print"".join(r)

which has a diff of 224 bits instead.

(-4 bytes thanks to Stefan Pochmann)

Explanation

Here's an alternate expanded version:

I=100*[100*"0"]

for _ in range(4):
 I=map(list,zip(*I[::-1]))

 for i in range(25):
  for j in range(75):
   I[i][j]=`+[abs(i%12-6)+5<j/2,j>i/2+24,2*i>72-j][j/25]`

for r in I:print"".join(r)

For this version, we treat the identicon as a 4x4 grid of patterns. We start with a 100x100 grid of 0s and do the following four times:

  • Fill in the first three patterns on pattern row 1 using inequalities
  • Rotate the whole thing clockwise

enter image description here

The original version is similar, but instead of rotating after the three patterns are complete, we rotate every time we modify a single cell. This makes the program take a few seconds, but the output is the same.

\$\endgroup\$
  • \$\begingroup\$ You could join the definitions of J and r into one line using a semicolon. \$\endgroup\$ – Zach Gates May 3 '15 at 9:37
  • \$\begingroup\$ @ZachGates I don't think that actually saves anything, because you're just replacing a newline with a semicolon \$\endgroup\$ – Sp3000 May 3 '15 at 9:39
  • \$\begingroup\$ Good point. I didn't think of that. \$\endgroup\$ – Zach Gates May 3 '15 at 9:45
  • 1
    \$\begingroup\$ @Sp3000 Unles you're on Windows, where newlines are 2 bytes. xD \$\endgroup\$ – Kroltan May 3 '15 at 15:15
  • 1
    \$\begingroup\$ ~i%12<j/2>i%12 is 3 shorter than abs(i%12-6)+5<j/2 but leads to 224 diff I think. \$\endgroup\$ – Stefan Pochmann May 4 '15 at 0:06
19
\$\begingroup\$

C, 255 245 237 234 bytes

C's identicon is really symmetrical.

C identicon

Golfed: (newlines added for "readability")

d[100],j,y,i,o[100];
main(c){
for(;i<100;++i){j=i>12?25-i:i,y=j<7?-1u>>63-j:127,d[i]=y<<12-j|y<<(j<7?12:j+6),
o[i]=i<25?(-1<<12|-1u>>76-i|-(i<13))<<25|d[i]:d[i-25]<<25;
for(c=50;c--+50;putchar(o[i<50?i:99-i]>>(c<0?~c:c)&1|48));puts("");}}

This stores half of each line in the top half into a 64-bit integer, then prints the lower 50 bits of the appropriate integer in binary twice, with the second print being reversed.

64-bit ints are required for this to run (if your system does not use 64-bit ints, then you may add long or long long before d[50], and (long) or (long long) after o[i-1]=i<26?).

Ungolfed and commented:

int diamond[25], j, y, i, out[50];
main(c){
    // generate diamond pattern
    for(i = 0; i < 25; ++i){
        j = i > 12 ? 25 - i : i;
        y = j < 7 ? -1u >> 63 - j : 127;
        diamond[i] = y << 12 - j | y << (j < 7 ? 12 : j + 6);
    }

    // generate top half outputs in reverse order
    for(i = 0; i < 50; ++i){
        if(i < 25)
            // i < 50: out[i] = [diamond] [0 ... x25]
            out[i] = diamond[i] << 25;
        else
            // i < 25: out[i] = [1...x25] [diamond]
            out[i] = (int)(-1 << 12 | -1u >> 27 + i | -(i > 36)) << 25 | diamond[i - 25];
        // i >= 50: use out[100 - i]
    }
    // print rows
    for(i = 50; i-- + 50; putchar('\n')){
        // print last 50 bits of the correct 64-bit integer, then print it reversed
        for(c = 50; c-- + 50; putchar(out[i < 0 ? -i - 1 : i] >> (c < 0 ? -c - 1 : c) & 1 | '0'));
    }
}

Output has 291 errors.

Thanks to ace for the tip of using puts("")

\$\endgroup\$
  • 7
    \$\begingroup\$ Only 291? I think we're ready to ship! \$\endgroup\$ – qwr May 3 '15 at 22:04
  • 1
    \$\begingroup\$ Replace putchar(10) with puts("") to save 3 bytes. \$\endgroup\$ – ace_HongKongIndependence May 4 '15 at 10:33
19
\$\begingroup\$

C, 224 206 200 176 bytes, 243 errors

char b[101],i,j,k=1,s,a;main(){for(;i+1;i+=k=i-50?puts(b),k:-1)for(j=0;j<50;j++)s=i-j,a=i+j-49|1,b[j]=b[99-j]=(i/25+j/25?14/a&&s/12&&38/s&&a/6|19/s+s/31:i<13||j<13^i+j>36)+48;}

To replicate:

C Identicon

The above code outputs binary which correlates to this image, with 243 errors:

243 Errors

From what I can tell, I use a rather different method from es1024's solution. This method can probably be further golfed, so I'll hold off on explanation for a bit, but here it is in its unraveled glory:

char b[101],i,j,k=1,s,a;
main(){
    for(;i+1;i+=k=i-50?puts(b),k:-1)
        for(j=0;j<50;j++)
            s=i-j,
            a=i+j-49|1,
            b[j]=b[99-j]=(i/25+j/25?14/a&&s/12&&38/s&&a/6|19/s+s/31:i<13||j<13^i+j>36)+48;
}

It essentially uses a set of inequalities to define the polygons, and relies heavily on symmetry.

It is currently midnight, and my ability to read my own code is rapidly deteriorating. You can probably fiddle with some constants to lower the errors, but I can only consistently break everything.

Fun fact, not only is this the shortest version I have come up with, but gcc throws no warnings!

\$\endgroup\$
  • \$\begingroup\$ Make the outer for loop for(;i+1;i+=k=i-50?puts(b),k:-1) so as to cut down on one semicolon and two braces, saving 3 bytes. \$\endgroup\$ – ace_HongKongIndependence May 4 '15 at 10:37
  • \$\begingroup\$ @ace Thanks, nice catch! Down to 200 bytes. \$\endgroup\$ – BrainSteel May 4 '15 at 14:41
  • \$\begingroup\$ You can move k=1 to main(k) to save 3 bytes. \$\endgroup\$ – es1024 May 5 '15 at 7:30
16
\$\begingroup\$

gs2: 72 bytes, 200 errors

Haven't really golfed this yet, not sure if I will. Mnemonics:

# Square
abs both1 biggest 6 <= b5
# Left triangle
{ over abs both1 + 13 <= swap 1 < and }
# Diagonal triangle
{ >= @0 double 10 + @4 <= or }
              # ^ 12 gives way more accuracy here but pushing 10 saves a byte.

# Plot each of these
3 make-array
{ pop-a -12 13 crange dup cartesian-product
  dump swap push-a eval show m5
  25 / } map

# Make corner
dump
reverse zip @1 rot zip +
unlines lines

dup reverse transpose zip
dup reverse show reverse m2
+ unlines

The program itself:

23 f8 39 16 75 e4 08 45 23 f8 30 01 0d 75 42 11
70 35 09 08 73 a0 2a 1a 30 a4 75 36 09 13 0e 08
cc 02 f4 ff 01 0d 4f 40 83 0e 42 d0 20 52 ec 01
19 33 09 34 0e 20 b0 a1 43 b0 30 2b 2a 40 20 9a
b0 40 20 52 20 e9 30 2b
\$\endgroup\$
9
\$\begingroup\$

Z80, 194 bytes, 0 errors

Z80 identicon

Z80, 178 bytes, 80 errors

Z80 identicon with errors

The errors are highlighted in green.

As this is an old-school CPU, I have used old-school conventions. I have used &8000 for hex values instead of the more familiar 0x8000 and I have chosen to end each line of the pattern with a "\r" instead of a "\n".

Source code HEX encoded

         0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
        -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
&8000   69 31 18 00 DB 42 81 E7 21 00 40 11 04 80 0E 04
&8010   06 19 D5 1A F5 C5 E6 03 5F 1A 32 20 80 06 19 18
&8020   00 36 31 23 10 F9 C1 F1 E6 FC 0F 0F 20 E6 36 0D
&8030   23 D1 10 DE 13 0D 20 D8 C9 3E 1A 90 58 C1 C5 D5
&8040   58 47 7B 87 FE 1A 38 02 D6 19 5F 80 FE 1B 28 34
&8050   18 0E 78 C1 C5 5F D5 87 FE 1A 38 02 D6 19 5F 80
&8060   FE 1A 28 20 30 06 90 90 30 1A 18 14 90 90 38 14
&8070   FE 01 38 10 20 0A 7B D6 05 30 FC C6 05 0F 38 04
&8080   36 30 18 02 36 31 D1 43 18 99 58 C1 C5 78 83 FE
&8090   0D 38 26 FE 27 30 22 93 93 30 04 FE F3 30 04 FE
&80A0   0E 30 16 83 83 FE 15 38 14 FE 20 30 10 93 93 30
&80B0   04 FE FB 30 04 FE 06 30 04 36 30 18 02 36 31 43
&80C0   18 C6

Source code explained

As the Z80 is a CPU, it doesn't have any standard output of its own. As such, I merely wrote each character directly into memory, starting from &4000, and then MEMDUMP'd the 10,100 bytes to verify the correct pattern.

The Z80 has registers as follows:

+-------+
| B / C |  8-bit general purpose B & C or 16-bit general purpose BC
+-------+
| D / E |  8-bit general purpose D & E or 16-bit general purpose DE
+-------+
| H / L |  8-bit general purpose H & L or 16-bit specialised HL
+-------+
| A | F |  8-bit accumulator A (main working register) & Flag register F
+-------+

The special Flag register contains the following flags: SZ-H-VNC. Sign, Zero, Half-carry, Overflow (also used as Parity), Negative and Carry. The positions marked by - are unused. The Half-carry and Negative flags are only used internally by the CPU. Sign and Overflow/Parity take extra bytes to use so I am only using Zero and Carry which get set or reset after each calculation, but not when moving values around.

There are other registers available but they aren't relevant to a golfing challenge as they take extra bytes to use.

  • LD loads a value into a register or address, e.g. LD C, 4 is C = 4. The value can be direct (one or two extra bytes for an 8-bit or 16-bit value respectively) or can be copied from another register. A value of (HL) means copy to or from the address pointed to by HL.
  • PUSH and POP push (save to) and pop (restore from) the stack, which can only store 16-bit values. As such, AF is treated as a single 16-bit register even though no other instructions use it like that.
  • AND is bitwise and. The Z80 has no boolean logic instructions, but does have boolean flags.
  • JR jump relative using a one-byte signed offset. This uses one byte less than the absolute jump JP, but has fewer conditions that can be tested for.
  • INC and DEC increment and decrement 8 and 16 bit registers.
  • DJNZ decrement and jump if non-zero. This does exactly the same as DEC B; JR NZ, ##; in one less byte but is only available for the B register.
  • RET returns to the calling location. It can optionally have conditions on it.
  • ADD and SUB add to and subtract from either the 8 bit A register or the 16 bit HL register.
  • CP compare subtracts the value from the A register, sets flags as appropriate but discards the result leaving A unchanged.
  • RRCA rotate right circular accumulator. Rotates all the bits in A once to the right, copying bit 0 into bit 7. It also copies bit 0 into the Carry (C) flag, not to be confused with the C register.

Every Identicon pattern can be broken down like so:

0451
4885
6887
2673

where 0-3 are the corners, rotated as appropriate, 4-7 are the edge tiles, rotated as appropriate and 8 is the centre tile which is (as far as I can tell) always rotationally symetrical.

Luckily, the Z80 Identicon can be simplified to:

3123
1002
2001
3213

I put the "0"s in the centre to enable me to efficiently check for an end condition. In fact, to golf the code it made sense to do almost everything backwards!

:Offsets is a block of four byte values which I use as offsets to the pattern for each block. The program works out which block to run then alters itself to jump to the right code. Strangely, this seems to use fewer bytes than by checking directly!

:DATA (also called magic data in the comments!) is the encoded order in which the blocks need to be rendered. There are 16 values, normally requiring 16 bytes but since each value is only 2 bits long I was able to put 4 into one byte, saving 12 bytes! The code to store, restore and decode these values is 6 bytes. Additionally, by avoiding using the number 0 in the highest 2 bits I was able to double this as a counter, saving at least 3 bytes (2 to initialise, 1 to decrement)! Total bytes saved: 12 - 6 + 3 = 9.

The offset data must be stored at a location ending in 00 hex to work properly. I chose &8000 as it seemed like a good out-of-the-way location. This means that the program starts at &8008. Coincidentally, Intel produced an early CPU called the 8008 which could be considered the grandfather of the Z80! Intel also produced the 8080, which Zilog based their Z80 on, being fully compatible with. The Z80 has a range of extended instructions which the 8080 doesn't. I have avoided using these extended instructions as each one has a one-byte prefix, meaning that this program will also produce the same results on the 8080!

Since the pattern for Block-3 is all "1"s I have embedded it into the main loop, which is why it has an offset of 00. This saves 2 bytes by not having to return from Block-3! Luckily I was able to fit the starting locations for all four blocks into less than 128 bytes. This is good because the range of a relative jump is -128 to 127 from the current position, calculated after reading the offset byte. I.e. a JR instruction reads two bytes then performs the calculation. JR 00 does nothing. JR 01 skips one byte. JR FF goes back by one byte causing the next instruction to be the offset of the JR just executed, which is really bad because the instruction FF is not for the faint hearted! JR FE goes back by two bytes causing an infinite loop, etc. However, the jump back from Block-0 is too far (less than -128) so I simply jump back into a previous block, which then jumps again!

#### DATA ####
:Offsets (&8000)                        # It is important that this address is of the form &XX00
69 (#Block-0, &808A)
31 (#Block-1, &8052)
18 (#Block-2, &8039)
00 (#Block-3, &8021)
:DATA (&8004)
DB 42 81 E7                             # Magic data

#### CODE ####
:MAIN (&8008)
21 00 40 ..   LD    HL, &4000           # Start address of pattern output
11 04 80 ..   LD    DE, #DATA (&8004)   # Load DE with data address
0E 04 .. ..   LD    C, 4                # Load C with 4 (outer loop)
:OUTY (&8010)
06 19 .. ..     LD    B, 25               # Load B with 25 (outer loop)
:INRY (&8012)
D5 .. .. ..     ! PUSH  DE                  # DE -> Stack, Stack = "DE" (save block pattern address)
1A .. .. ..     ! LD    A, (DE)             # Get block mask (ppoonnmm)
:OUTX (&8014)
F5 .. .. ..         PUSH  AF                  # AF -> Stack, Stack = "DE, AF" (save block mask)
C5 .. .. ..         PUSH  BC                  # BC -> Stack, Stack = "DE, AF, BC" (save outer loop variables)
E6 03 .. ..         AND   &03                 # Get block number (0, 1, 2 or 3). A = 000000XX where each X can be 0 or 1
5F .. .. ..         LD    E, A                # Copy A to E. DE now contains &800X where X is one of (0, 1, 2 or 3)
1A .. .. ..         LD    A, (DE)             # Copy the byte at address pointed to by DE to A
32 20 80 ..         LD    (&8020!), A         # Alter JR instruction in innermost loop with offset of current pattern block
06 19 .. ..         LD    B, 25               # Load B with 25 (inner loop)
:INRX (&801F)
18 00 .. ..           JR    00                  # (Relative) Jump to overridden pattern block location (Mock CALL). The second byte of this instruction is at address &8020 (see instruction two above)
:Block-3 (&8021 + &00 = &8021)
36 31 .. ..           LD    (HL), 49            # Write ASCII "1" to address in HL
:RESUME (&8023)
23 .. .. ..           INC   HL                  # Move pointer to next (8 bit) memory location
10 F9 .. ..           DJNZ  #INRX (&801F)       # Repeat B times (end of inner B loop)
&8026
C1 .. .. ..         POP   BC                  # Stack -> BC, Stack = "DE, AF"
F1 .. .. ..         POP   AF                  # Stack -> AF, Stack = "DE"
E6 FC .. ..         AND   &FC                 # Zero out current block number: A = XXXXXX00 where each X can be 0 or 1
0F .. .. ..         RRCA                      # Rotate Right A. (rotate bits to the right by one place. Bit 0 is copied into bit 7)
0F .. .. ..         RRCA                      # Rotate Right A again. The next pattern block is now in bits 1 & 0.
20 E6 .. ..         JR    NZ, #OUTX (&8014)   # If A is Non-Zero (Relative) Jump (Repeat until pattern is empty)
&802E
36 0D .. ..       LD (HL), 0D               # Write "\r"
23 .. .. ..       INC HL                    # Move pointer
D1 .. .. ..       POP DE                    # Stack -> DE, Stack = ""
10 DE .. ..       DJNZ  #INRY (&8012)       # Repeat B times (end of outer B loop)
&8034
13 .. .. ..     INC   DE                  # Move DE to next pattern of blocks
0D .. .. ..     DEC   C                   # Decrement C (end of outer C loop)
20 D8 .. ..     JR    NZ, #OUTY (&8010)   # If C is Non-Zero (Relative) Jump (Repeat C times)
&8038
C9 .. .. ..   RET                       # Return

:Block-2 (&8039)
3E 1A .. ..   LD    A, 26               # A = 26
90 .. .. ..   SUB   A, B                # A = 26 - x
58 .. .. ..   LD    E, B                # Copy B to E, E = x
C1 .. .. ..   POP   BC                  # Restore B (& C), B = y
C5 .. .. ..   PUSH  BC                  # Save B (& C) again
D5 .. .. ..   PUSH  DE                  # Save (D &) E
58 .. .. ..   LD    E, B                # E = y
47 .. .. ..   LD    B, A                # B = 26 - x
7B .. .. ..   LD    A, E                # A = y
87 .. .. ..   ADD   A, A                # A = 2 * y
FE 1A .. ..   CP    26                  # A - 26 (compare)
38 02 .. ..   JR    C, 2                # if Carry, skip next instruction
D6 19 .. ..     SUB   A, 25               # A = 2 * y % 25
5F .. .. ..   LD    E, A                # Copy A to E, E = 2 * y % 25, B = 26 - x
80 .. .. ..   ADD   A, B                # A = 2 * y % 25 + 26 - x
:Extra-1s
FE 1B .. ..   CP    27                  # A - 27 (compare)
28 34 .. ..   JR    Z, #Bl1-1           # if Zero, (Relative) Jump to Block-1 "1"
:End-Extra-1s
18 0E .. ..   JR    #BL1a               # (Relative) Jump to Block-1a

:Block-1 (&8052)
78 .. .. ..   LD    A, B                # A = x
C1 .. .. ..   POP   BC                  # Restore B (& C), B = y
C5 .. .. ..   PUSH  BC                  # Save B (& C) again
5F .. .. ..   LD    E, A                # Save A (copy of B) in E, E = x
D5 .. .. ..   PUSH  DE                  # Save (D &) E
87 .. .. ..   ADD   A, A                # A = 2 * x
FE 1A .. ..   CP    26                  # A - 26 (compare)
38 02 .. ..   JR    C, 2                # if Carry, skip next instruction
D6 19 .. ..     SUB   A, 25             # A = 2 * x % 25
5F .. .. ..   LD    E, A                # Copy A to E, E = 2 * x % 25, B = y
80 .. .. ..   ADD   A, B                # A = 2 * x % 25 + y
:BL1a                                   # From this point on until character written to memory, swap x and y in comments if from Block-2
FE 1A .. ..   CP    26                  # A - 26 (compare)
28 20 .. ..   JR    Z, #Bl1-1           # if Zero, (Relative) Jump to Block-1 "1"
30 06 .. ..   JR    NC, #BL1b           # if Non-Carry, (Relative) Jump to Block-1b
90 .. .. ..   SUB   A, B                # A = 2 * x % 25
90 .. .. ..   SUB   A, B                # A = 2 * x % 25 - y
30 1A .. ..   JR    NC, #Bl1-1          # if Non-Carry, (Relative) Jump to Block-1 "1"
18 14 .. ..   JR    #Bl1-0              # (Relative) Jump to Block-1 "0"
:BL1b
90 .. .. ..   SUB   A, B                # A = 2 * x % 25
90 .. .. ..   SUB   A, B                # A = 2 * x % 25 - y
38 14 .. ..   JR    C, #Bl1-1           # if Carry, (Relative) Jump to Block-1 "1"
FE 01 .. ..   CP    1                   # A - 1 (compare)
38 10 .. ..   JR    C, #Bl1-1           # if Carry, (Relative) Jump to Block-1 "1"
:Jaggies
20 0A .. ..   JR    NZ, #Bl1-0          # if Non-Zero, (Relative) Jump to Block-1 "0"
7B .. .. ..   LD    A, E                # A = 2 * x % 25
:MOD5
D6 05 .. ..   SUB   A, 5                # A = A - 5
30 FC .. ..   JR    NC, MOD5            # if Non-Carry (A >= 0), (Relative) Jump to #MOD5
C6 05 .. ..   ADD   5                   # A = 2 * x % 5. A was [-5,-1], needed to add 5 for positive mod 5
0F .. .. ..   RRCA                      # Rotate Right A. Bit 0 is copied into Carry flag
38 04 .. ..   JR    C, #Bl1-1           # if Carry, (Relative) Jump to Block-1 "1"
:End-Jaggies
36 30 .. ..   LD    (HL), 0             # Write "0"
18 02 .. ..   JR    #B1-end             # Skip next instruction
36 31 .. ..   LD    (HL), 1             # Write "1"
:B1-end
D1 .. .. ..   POP   DE                  # Restore (D &) E, E = x
43 .. .. ..   LD    B, E                # Restore B from E
18 99 .. ..   JR    #RESUME (&8023)     # (Relative) Jump back into inner loop

:Block-0 (&808A)
58 .. .. ..   LD    E, B                # Copy B to E, E = x
C1 .. .. ..   POP   BC                  # Restore B (& C), B = y
C5 .. .. ..   PUSH  BC                  # Save B (& C) again
78 .. .. ..   LD    A, B                # A = y
83 .. .. ..   ADD   A, E                # A = y + x
FE 0D .. ..   CP    13                  # A - 13 (compare)
38 26 .. ..   JR    C, #Bl0-0           # if Carry, (Relative) Jump to Block-0 "0"
FE 27 .. ..   CP    39                  # A - 39 (compare)
30 22 .. ..   JR    NC, #Bl0-0          # if Non-Carry, (Relative) Jump to Block-0 "0"
93 .. .. ..   SUB   A, E                # A = y
93 .. .. ..   SUB   A, E                # A = y - x
30 04 .. ..   JR    NC, 4               # if Non-Carry (A >= 0), skip next two instructions
FE F3 .. ..   CP    -13                 # A - -13 (compare)
30 04 .. ..   JR    NC, 4               # if Non-Carry, skip next two instructions
FE 0E .. ..   CP    14                  # A - 14 (compare)
30 16 .. ..   JR    NC, #Bl0-0          # if Non-Carry, (Relative) Jump to Block-0 "0"
83 .. .. ..   ADD   A, E                # A = y
83 .. .. ..   ADD   A, E                # A = y + x
FE 15 .. ..   CP    21                  # A - 21 (compare)
38 14 .. ..   JR    C, #Bl0-1           # if Carry, (Relative) Jump to Block-0 "1"
FE 20 .. ..   CP    32                  # A - 32 (compare)
30 10 .. ..   JR    NC, #Bl0-1          # if Non-Carry, (Relative) Jump to Block-0 "1"
93 .. .. ..   SUB   A, E                # A = y
93 .. .. ..   SUB   A, E                # A = y - x
30 04 .. ..   JR    NC, 4               # if Non-Carry, skip next two instructions
FE FB .. ..   CP    -5                  # A - -5 (compare)
30 04 .. ..   JR    NC, #Bl0-0          # if Non-Carry, (Relative) Jump to Block-0 "0"
FE 06 .. ..   CP    6                   # A - 6
30 04 .. ..   JR    NC, #Bl0-1          # if Non-Carry, (Relative) Jump to Block-0 "1"
:Bl0-0 (&80B9)
36 30 .. ..   LD    (HL), 30            # Write "0"
18 02 .. ..   JR    2                   # Skip next instruction
:Bl0-1 (&80BD)
36 31 .. ..   LD    (HL), 31            # Write "1"
43 .. .. ..   LD    B, E                # Restore B from E
18 C6 .. ..   JR    -39!=&8041          # (Relative) Jump back into inner loop
&80C2

There is certainly room to golf this a bit further. My first fully working version was 239 bytes. 4 bytes can be saved by removing the section "Extra-1s" at the expense of 48 errors and a further 12 bytes can be saved by removing the section "Jaggies" at the expense of 32 errors.

\$\endgroup\$
8
\$\begingroup\$

Haskell, 201 190 bytes, 44 errors

main=mapM_ putStrLn$h++map v(v h)
h=[[b$p i j|p<-q,j<-x]|q<-[[a,r,d,a],[r,w,w,d]],i<-x]
a i j=abs i+abs j>13
d i j=i>0&&abs j+i<12
r=flip d
w _ _=1<3
v=reverse
x=[-12..12]
b x|x='0'|1<3='1'

Haskell

Uses a matrix of functions for each different shape: a (diamond); u, d, l, r (triangles facing each direction) and w (white), and applies each to a 25x25 grid with coordinates [-12..12]. The diamond and triangle shapes are computed using the Manhattan norm, similar to flawr's Octave solution.

Actually only generate the upper half, which needs only a, w, d, and r. Produce the lower half through mirroring (map reverse . reverse).

\$\endgroup\$
  • 2
    \$\begingroup\$ I love how flip actually performs a geometric rotation here. \$\endgroup\$ – ballesta25 May 5 '15 at 16:12
  • \$\begingroup\$ You can drop the _ in mapM_. Also, if you remove the definition of l and replace the matrix with: [[a,r,d,a],[r,w,w,d],[u,w,w,flip u],[a,u,u,a]], you can save a couple of bytes and add a couple of errors. \$\endgroup\$ – Lynn May 5 '15 at 16:48
  • \$\begingroup\$ Also, abs j+i+1<13 is just abs j+i<12 \$\endgroup\$ – Lynn May 5 '15 at 16:49
8
\$\begingroup\$

C# - 423 bytes, 237 errors

c# identicon

Just piling up inequalities. Most of the errors are due to me substituting t(=25) in places that should be using 24.

using System;class A{static void Main(string[]a){for(int t=25,k,l,i,j=0;j<100;j++){for(i=0;i<100;i++){Console.Write((((i>12&&i<87&&j>12&&j<87)||Math.Abs(i-49.5)+Math.Abs(j-49.5)<63)&&!((i>36&&i<63)||(j>36&&j<63)||(i>11&&i<88&&j>t&&j<75)||(j>11&&j<88&&i>t&&i<75)))||(i>t&&i<75&&j>t&&j<75&&(((k=i%t)*2<(l=j%t)&&k*-2+t>l)||(l*2<k&&l*-2+t>k)||((k=t-k)*2<(l=t-l)&&k*-2+t>l)||(l*2<k&&l*-2+t>k)))?"0":"1");}Console.WriteLine();}}}

Here is an attempt to visualize how it works:

process visualization

More readable code:

using System;
class A
{
    static void Main(string[]a)
    {
        for(int t=25,k,l,i,j=0;j<100;j++){for(i=0;i<100;i++){
        Console.Write(
        (((i>12&&i<87&&j>12&&j<87) //big square
        ||Math.Abs(i-49.5)+Math.Abs(j-49.5)<63) //big diamond
        &&!((i>36&&i<63)||(j>36&&j<63)||(i>11&&i<88&&j>t&&j<75)||(j>11&&j<88&&i>t&&i<75))) //subtract four central rects
        ||(i>t&&i<75&&j>t&&j<75 //add the central square
        &&(((k=i%t)*2<(l=j%t)&&k*-2+t>l) //stars: subtract left sides
        ||(l*2<k&&l*-2+t>k) //stars: subtract top sides
        ||((k=t-k)*2<(l=t-l)&&k*-2+t>l) //stars: subtract right sides
        ||(l*2<k&&l*-2+t>k)) //stars: subtract bottom sides
        )
        ?"0":"1");
        }Console.WriteLine();}
    }
}

Probably could golf the parens and logical operators a bit, but I'm getting Lisp flashbacks.

\$\endgroup\$
  • \$\begingroup\$ That identicon looks challenging! Nice work. \$\endgroup\$ – DLosc May 6 '15 at 5:08
  • \$\begingroup\$ Love the progression visualization \$\endgroup\$ – Jeremy Weirich Aug 8 '17 at 12:40
8
\$\begingroup\$

Perl 186 184 181 151 147 bytes, 0 errors

Perl identicon

for$y(@i=0..99){$l=24-($k=$_%25-$y%25)-$y%25*2,$c=!($_/25%3)+!($y/25%3),print$c-2?abs$k>5|abs$l>5&&$c:$k<0^$l>0^$_>49^$y>49|!$k|!$l,'
'x/99/ for@i}

The code is almost as simple as the image is! I could reduce it by two more bytes by having the pattern start with a newline instead of ending with it but technically it doesn't validate without errors. getting to the point where I'm having a hard time understanding it!

\$\endgroup\$
  • \$\begingroup\$ I played with your solution and got down to 151 bytes: ideone.com/HPgN11 or 141 + 1 flag: ideone.com/sJcjNq Also in your version EOL print condition could be simply x/99$/. \$\endgroup\$ – nutki May 7 '15 at 12:36
  • \$\begingroup\$ @nutki Since the flag version saves 10 bytes but the flag itself takes up 10 bytes I've gone for your other solution! \$\endgroup\$ – CJ Dennis May 8 '15 at 11:15
7
\$\begingroup\$

JavaScript (ES6), 239 bytes, 99 different

f=(c,n=50)=>Array(n).fill().map(c)
a=f((e,y)=>f((_,x)=>+((x+y>48&(x+y<68|x+y>80|x<y-6|x>y+6))|x>y-13&x<13&y>11)))
f((e,i)=>f((g,j)=>a[i].push(a[49-j][i])))
f((e,i)=>a.push(f((g,j)=>a[49-i][99-j],100)))
alert(a.map(e=>e.join('')).join(`
`))

This uses inequalities to generates the shapes for one quadrant, and the rest of the code rotates that to fill the others.

The text was just JavaScript. This is a pretty simple identicon:

JavaScript identicon

Use the snippet below to verify, as it is uses more well-supported JavaScript and outputs in a monospace font. You'll probably have to click "Full page" to see all of it.

f=function(c,n){
  n=n||50
  for(arr=[];n>0;n--)arr.push(undefined)
  return arr.map(c)
}
a=f(function(e,y){
  return f(function(_,x){
    return +((x+y>48&(x+y<68|x+y>80|x<y-6|x>y+6))|x>y-13&x<13&y>11)
  })
})
f(function(e,i){
  f(function(g,j){
    a[i].push(a[49-j][i])
  })
})
f(function(e,i){
  a.push(f(function(g,j){
    return a[49-i][99-j]
  },100))
})
document.getElementById('p').innerHTML=a.map(function(e){return e.join('')}).join('\n')
<style>pre{font-size:12px;line-height:100%}</style><pre id="p"></pre>

\$\endgroup\$
6
\$\begingroup\$

Python 3, 975 963 bytes

python identicon

Z,L,J=zip,list,''.join;y=[134217727,520093695,2130706431,8573157375,34334572543,137413787647,274848546815,68690116607,17148411903,4262461439,1041235967,235405311,34078719,235405311,1040449535,4261675007,17146445823,68686053375,274844418047,137405431807,34326216703,8556396543,2113945599,503332863,100671487,1125899873288192,562949919866880,562949919866880,562949919866880,281474943156224,281474943156224,140737454800896,140737454800896,70368710623232,35184338534400,35184338534400,17592152489984,17592152489984,17592152489984,8796059467776,8796059467776,4398012956672,4398012956672,2198989701120,1099478073344,1099478073344,549722259456,549722259456,549722259456,274844352512];C=[L(n) for n in map(lambda j:'0'*(50-len(j[2:]))+j[2:],[bin(i) for i in y])];U=L(Z(*C[::-1]));Q=L(Z(*U[::-1]));Y=L(Z(*Q[::-1]));Y=[J(i) for i in Y];Q=[J(i) for i in Q];U=[J(i) for i in U];C=[J(i) for i in C];H=[i+j for i,j in Z(C,U)];R=[i+j for i,j in Z(Y,Q)];r='\n'.join(H+R);print(r)

The string printed is "Python" at 975 bytes with 30 errors.

For "Python 3" I used

Z,L,J=zip,list,''.join;y=[206183596032,515427532800,1082364788736,2190466744320,4393785065472,8793979084800,17591145854976,35046429810176,69887472902016,139672235548640,279293098729464,558560492658686,1117108092018687,1121510446079998,560768075440120,280409723903968,140256217079680,70230801899008,35183331899392,17590072107008,8791831576576,4389489999872,2181876416512,1065183346688,481061502976,844424930131968,1055531162664960,1108307720798208,1121501860331520,1124800395214848,1125625028935680,1125831187369984,1125607849080832,1123971466558464,1117377618050560,1090990144356096,985437229547392,563224798298048,985437229547456,1090990144356224,1117377618050816,1123971466558976,1125607849081856,1125831187372032,1125625028935680,1124800395214848,1121501860331520,1108307720798208,1055531162664960,844424930131968];C=[L(n) for n in map(lambda j:'0'*(50-len(j[2:]))+j[2:],[bin(i) for i in y])];U=L(Z(*C[::-1]));Q=L(Z(*U[::-1]));Y=L(Z(*Q[::-1]));Y=[J(i) for i in Y];Q=[J(i) for i in Q];U=[J(i) for i in U];C=[J(i) for i in C];H=[i+j for i,j in Z(C,U)];R=[i+j for i,j in Z(Y,Q)];r='\n'.join(H+R);print(r)

Which would bring it up to 1104 bytes with 124 errors, but I think I'll stick with just "Python" unless requested by OP.

\$\endgroup\$
  • \$\begingroup\$ Since functions (including member functions) are first-class objects in Python, you can just do J=''.join and save 12 characters on the lambda. \$\endgroup\$ – DLosc May 6 '15 at 2:22
  • \$\begingroup\$ Wonderful, thanks! @DLosc \$\endgroup\$ – Zach Gates May 6 '15 at 2:33
  • \$\begingroup\$ Other savings: 1) Rewrite several of the list comprehensions with map; 2) save a few bytes by defining R=lambda x:L(Z(*x[::-1])); 3) don't need spaces after closing parentheses. \$\endgroup\$ – DLosc May 6 '15 at 2:41
5
\$\begingroup\$

HTML - 223 210 193 191 bytes, 0 errors

HTML identicon

<!DOCTYPE html><title>A</title><script>D=document;M=Math.abs;for(y=0;b=y%75/25&3,y<100;D.write('<br>'),++y)for(x=0;a=x%75/25&3,x<100;++x)D.write(+!(a+b?a*b:M(x%25-12)+M(y%25-12)>13))</script>

100% valid HTML. Both HTML and JavaScript are quite verbose so despite the simplicity of the identicon the code is still very long.

\$\endgroup\$
  • \$\begingroup\$ You can save 1 byte by replacing your document.write() with document.write(c?2-c/2:+(Math.abs(i)+Math.abs(j)<14)),++x);. Also, if you click on the icon with <>, you can build a stacksnippet to showcase your code. \$\endgroup\$ – Ismael Miguel May 7 '15 at 17:12
  • \$\begingroup\$ Here is a 210 bytes-long solution: <!DOCTYPE html><title>A</title><script>for(W=document.write,y=0,A=25;b=y/A&3,j=y%A-12,y<100;W('<br>'),++y)for(x=0;a=x/A&3,c=a*(3-a)+b*(3-b),i=x%A-12,x<100;W(c?2-c/2:+(Math.abs(i)+Math.abs(j)<14)),++x);</script>. \$\endgroup\$ – Ismael Miguel May 7 '15 at 17:58
  • \$\begingroup\$ @IsmaelMiguel I can't run that. Firebug says "TypeError: 'write' called on an object that does not implement interface HTMLDocument." However, using your ideas I still managed to cut it down to 210 bytes! \$\endgroup\$ – CJ Dennis May 8 '15 at 12:29
  • \$\begingroup\$ It was working with me on Notepad++ (plugin Preview HTML). Maybe it was a quirk or a bug and the refresh wasn't happening as it should. I would love to upvote it again! \$\endgroup\$ – Ismael Miguel May 8 '15 at 16:42
  • 1
    \$\begingroup\$ <p style=font-size:25px>◆■■◆<br>■  ■<br>■  ■<br>◆■■◆</p> \$\endgroup\$ – Adám Mar 15 '16 at 18:52
5
\$\begingroup\$

PowerShell 2.0, 448 399 392 374 349 bytes, 49 errors

enter image description here

this is just printing one line at a time, with some fancy meta-replacement/expressions for golfing

filter a{switch($_){1{"1"*13;"0"*12}2{"0"*12;"1"*13}3{"1"*25}4{"0"*25}6{"1"*$b;"0"*(25-2*$b);"1"*$b}7{$b--;"0"*$b;"1"*(25-2*$b);"0"*$b}}}$a='1164132c6417dd3317c26317116313164441d847717d3771163441162443d827737d27741624441132362c7236dd7233c27246113246';$x='$($a[$d++])';0..17|%{iex "`"0x$x..0x$x|%{```$b=```$_;```$($x|a;$x|a;$x|a;$x|a)-join''}`""}|iex

ungolfed:

filter a
{
    switch($_)
    {
        1 { "1"*13; "0"*12 }
        2 { "0"*12; "1"*13 }
        3 { "1"*25 }
        4 { "0"*25 }
        6 {       "1"*$b; "0"*(25-2*$b); "1"*$b }
        7 { $b--; "0"*$b; "1"*(25-2*$b); "0"*$b }
    }
}
$a='1164132c6417dd3317c26317116313164441d847717d3771163441162443d827737d27741624441132362c7236dd7233c27246113246';
$x='$($a[$d++])';
0..17|%{iex "`"0x$x..0x$x|%{```$b=```$_;```$($x|a;$x|a;$x|a;$x|a)-join''}`""}|iex

this is what eventually gets piped to iex:

0x1..0x1|%{$b=$_;$(6|a;4|a;1|a;3|a)-join''}
0x2..0xc|%{$b=$_;$(6|a;4|a;1|a;7|a)-join''}
0xd..0xd|%{$b=$_;$(3|a;3|a;1|a;7|a)-join''}
0xc..0x2|%{$b=$_;$(6|a;3|a;1|a;7|a)-join''}
0x1..0x1|%{$b=$_;$(6|a;3|a;1|a;3|a)-join''}
0x1..0x6|%{$b=$_;$(4|a;4|a;4|a;1|a)-join''}
0xd..0x8|%{$b=$_;$(4|a;7|a;7|a;1|a)-join''}
0x7..0xd|%{$b=$_;$(3|a;7|a;7|a;1|a)-join''}
0x1..0x6|%{$b=$_;$(3|a;4|a;4|a;1|a)-join''}
0x1..0x6|%{$b=$_;$(2|a;4|a;4|a;3|a)-join''}
0xd..0x8|%{$b=$_;$(2|a;7|a;7|a;3|a)-join''}
0x7..0xd|%{$b=$_;$(2|a;7|a;7|a;4|a)-join''}
0x1..0x6|%{$b=$_;$(2|a;4|a;4|a;4|a)-join''}
0x1..0x1|%{$b=$_;$(3|a;2|a;3|a;6|a)-join''}
0x2..0xc|%{$b=$_;$(7|a;2|a;3|a;6|a)-join''}
0xd..0xd|%{$b=$_;$(7|a;2|a;3|a;3|a)-join''}
0xc..0x2|%{$b=$_;$(7|a;2|a;4|a;6|a)-join''}
0x1..0x1|%{$b=$_;$(3|a;2|a;4|a;6|a)-join''}

and this one which is 471 bytes, 104 errors, which uses rotation logic

filter x($x,$y){1..$_|%{$t=49-$x;$x=$y;$y=$t};$x;$y}0..9999|%{$i=$_;$x=$i%100;$y=[math]::floor($i/100);if($x-ge50){$x-=50;if($y-ge50){$y-=50;$x,$y=2|x $x $y}else{$x,$y=1|x $x $y}}else{if($y-ge50){$y-=50;$x,$y=3|x $x $y}}if($x-ge25){$x-=25;if($y-ge25){$y-=25;[int]([math]::abs(13-$x)+[math]::abs(12-$y)-lt7)}else{[int]($y-gt11)}}else{if($y-ge25){$y-=25;[int]($y-gt11)}else{[int](($y-le$x-or$y-le24-$x)-and($y-ge$x-or$y-ge24-$x))}}}|%{if($i%100){$s+=$_}else{$s;$s="$_"}};$s

(relatively) ungolfed:

function rotate($x, $y, $n)
{
    1..$n|%{
        $t = 49-$x
        $x = $y
        $y = $t
    }
    $x
    $y
}

$s=''
0..9999|%{
    $i=$_
    $x = $i%100
    $y = [math]::floor($i/100)
    if ($x -ge 50)
    {
        $x-=50
        if ($y -ge 50)
        {
            # bottom right
            $y -= 50
            $x,$y = rotate $x $y 2
        }
        else
        {
            # top right
            $x,$y = rotate $x $y 1
        }
    }
    else {if ($y -ge 50)
    {
        # bottom left
        $y -= 50
        $x,$y = rotate $x $y 3
    }}

    if ($x -ge 25)
    {
        $x-=25
        if ($y -ge 25)
        {
            $y-=25
            # bottom right
            [int]([math]::abs(13-$x)+[math]::abs(12-$y) -lt 7)
        }
        else
        {
            # top right
            [int]($y -gt 11)
        }
    }
    else
    {
        if ($y -ge 25)
        {
            $y-=25
            # bottom left
            [int]($y -gt 11)
        }
        else
        {
            # top left
            [int](($y -le $x -or $y -le 24-$x) -and ($y -ge $x -or $y -ge 24-$x))
        }
    }
}|%{if ($i%100){$s+=$_}else{$s;$s="$_"}};$s
\$\endgroup\$
4
\$\begingroup\$

Python 2, 712 711 bytes

This program generates the bit array for 'Python' by using run length encoding and storing runs as characters.

a=":>;$ 8'$;8' 6)$;6) 4+$;4+ 2-%:3, 0/%:1. /0&9.1 1.&9,3 3,'8*5 5*(7)6 7((7'8 9&)6$; ;$)O)$.$ 9&)O(%.% 7(*N(&,& 5**N'',' 3,+M'(*( 1.+M&)*) /0,L&*(* 0/-K%+(+ 2--K%,&, 4+.J$-&- 6).J$.$. 8'.V$ :%/ #<m $;j $;h $;f %:e %:c &9` &9^ '8\ (7[ (7Y )6V )6U )6U *5U *5U +4U +4U ,3U -2U -2U .1U .1U .1U /0U #<U0 #<U1 #<U1 #<U2 #<U2 #<U3 #<U3 #<U4 #<U4 #<U5 #<U5 #<U6 #<U6 #;V7 #9X7 #7Z8 #5\8 #3^9 #1`9 #/b: #-d: #+f; #)h; #'j #%l #b/% #c.' $.$V.) $.%-$K-+ %,&-$K-- %+(+%L,/ &*(+%L,0 &*))&M+. '(*)&M+, '(+''N** (&,&(N*( (&-%(O)& )$.%(O)$ <;$7(& <9&7(( <7(8'* <5*8', <3,9&. <1.9&0 </0:%/ <-2:%- <+4;$+ <)6;$) <'8@ <%:>".split()
for b in[[ord(c)-35for c in L]for L in a]:print''.join(c*n for c,n in zip('01'*8,b+[100-sum(b)]))

Before the auto-golfer, it looked (quite similar!) like:

ctext = ":>;$ 8'$;8' 6)$;6) 4+$;4+ 2-%:3, 0/%:1. /0&9.1 1.&9,3 3,'8*5 5*(7)6 7((7'8 9&)6$; ;$)O)$.$ 9&)O(%.% 7(*N(&,& 5**N'',' 3,+M'(*( 1.+M&)*) /0,L&*(* 0/-K%+(+ 2--K%,&, 4+.J$-&- 6).J$.$. 8'.V$ :%/ #<m $;j $;h $;f %:e %:c &9` &9^ '8\ (7[ (7Y )6V )6U )6U *5U *5U +4U +4U ,3U -2U -2U .1U .1U .1U /0U #<U0 #<U1 #<U1 #<U2 #<U2 #<U3 #<U3 #<U4 #<U4 #<U5 #<U5 #<U6 #<U6 #;V7 #9X7 #7Z8 #5\8 #3^9 #1`9 #/b: #-d: #+f; #)h; #'j #%l #b/% #c.' $.$V.) $.%-$K-+ %,&-$K-- %+(+%L,/ &*(+%L,0 &*))&M+. '(*)&M+, '(+''N** (&,&(N*( (&-%(O)& )$.%(O)$ <;$7(& <9&7(( <7(8'* <5*8', <3,9&. <1.9&0 </0:%/ <-2:%- <+4;$+ <)6;$) <'8@ <%:>".split()

for seq in [[ord(c)-35 for c in L] for L in ctext] :
    print ''.join(c*n for c,n in zip('01'*8, seq + [100 - sum(seq)]))

This RLE method should result in zero errors.

The identicon array for 'python' looks much easier, but I thought it would be cheating if I used that.

\$\endgroup\$
  • \$\begingroup\$ The change is probably because I modified the b/w conversion slightly to make some lines less jagged. \$\endgroup\$ – Calvin's Hobbies May 3 '15 at 6:49
  • \$\begingroup\$ Thanks. I have updated the answer based on the new bit array with zero errors. \$\endgroup\$ – Logic Knight May 3 '15 at 13:56
  • \$\begingroup\$ It's pretty interesting how your golfer chooses to start a newline instead of adding a space between in and zip. It seems to have missed the space between 35 and for though. \$\endgroup\$ – Sp3000 May 3 '15 at 16:55
  • \$\begingroup\$ @Sp3000, The inserted new line was probably my mistake in the copy/paste operation. I have added a new rule to optimise the 35 for type sequences (being careful to keep the space if the following identifier starts with an e!). Thanks for your advice. \$\endgroup\$ – Logic Knight May 4 '15 at 1:02
  • \$\begingroup\$ I think recent versions of Python have fixed the thing about identifiers beginning with e. Maybe try updating and testing? (for reference I tried on 2.7.9) \$\endgroup\$ – Sp3000 May 4 '15 at 1:06
4
\$\begingroup\$

IDL, 472 bytes, 290 errors

Ugh. This would be much shorter if I could store functions as variables, or do multiple string replacements at once, etc.

v=execute(repstr(repstr(repstr("n=25&a=12&b=24&r='IDLanROI'&x=rebin([0:b],n,n,/s)&y=#x,4)&w=.5*(x-1)&h=(y ge w@y lt b-.5*x)@~(y ge a-w@y lt a+w@x lt a)&i=reform((obj_new(r,[0,a,13,b,b,18,a,6,a,a,11,0],[a,0,0,11,a,a,6,a,18,b,b,a^,n,n)&j=reform(~((obj_new(r,[a,7,a,13,17,17,a],[7,a,17,17,13,a,7^),n,n)&print,string([[h,i,#i,1),#h,1)],[i,j,j,#i,1)],[#i,3),j,j,#i,2)],[#h,3),#i,3),#i,2),#h,2)]],'(100I1)')",'@',' and '),'#','rotate('),'^','])).containspoints(x,y)<1'))

enter image description here

1100000000000000000000000000000000000110000000000000000000000010000000000000111111111111111111111111
1111000000000000000000000000000000001111000000000000000000000111000000000000111111111111111111111111
1111110000000000000000000000000000011111100000000000000000001111100000000000011111111110111111111110
1111111100000000000000000000000000111111110000000000000000011111110000000000011111111110011111111110
1111111111000000000000000000000001111111111000000000000000111111111000000000001111111100011111111100
1111111111110000000000000000000011111111111100000000000001111111111100000000001111111100001111111100
1111111111111100000000000000000111111111111110000000000011111111111110000000000111111000001111111000
1111111111101111000000000000001111111011111111000000000111111101111111000000000111111000000111111000
1111111110001111110000000000011111110001111111100000001111111000111111100000000011110000000111110000
1111111000001111111100000000111111100000111111110000011111110000011111110000000011110000000011110000
1111100000001111111111000001111111000000011111111000111111100000001111111000000001100000000011100000
1110000000001111111111110011111110000000001111111111111111000000000111111100000001100000000001100000
1100000000001111111111110111111100000000000111111111111110000000000011111110000000111111111111000000
1111000000001111111111000011111110000000000000000000000000000000000111111110000000111111111111000000
1111110000001111111100000001111111000000000000000000000000000000001111111100000000011111111110000000
1111111100001111110000000000111111100000000000000000000000000000011111111000000000011111111110000000
1111111111001111000000000000011111110000000000000000000000000000111111110000000000001111111100000000
1111111111111100000000000000001111111000000000000000000000000001111111100000000000001111111100000000
1111111111110000000000000000000111111100000000000000000000000011111111000000000000000111111000000000
1111111111000000000000000000000011111100000000000000000000000011111110000000000000000111111000000000
1111111100000000000000000000000001111100000000000000000000000011111100000000000000000011110000000000
1111110000000000000000000000000000111100000000000000000000000011111000000000000000000011110000000000
1111000000000000000000000000000000011100000000000000000000000011110000000000000000000001100000000000
1100000000000000000000000000000000001100000000000000000000000011100000000000000000000001100000000000
0000000000000000000000000000000000001100000000000000000000000011000000000000000000000000000000000000
0000000000001100000000000111111111111111111111111111111111111111111111111110000000000001000000000000
0000000000011110000000000111111111111111111111111111111111111111111111111110000000000011100000000000
0000000000111111000000000111111111111111111111111111111111111111111111111110000000000111110000000000
0000000001111111100000000111111111111111111111111111111111111111111111111110000000001111111000000000
0000000011111111110000000111111111111111111111111111111111111111111111111110000000011111111100000000
0000000111111111111000000111111111111111111111111111111111111111111111111110000000111111111110000000
0000001111111111111100000111111111111111111111111111111111111111111111111110000001111111111111000000
0000011111110111111110000111111111111011111111111111111111111101111111111110000011111110111111100000
0000111111100011111111000111111111110001111111111111111111111000111111111110000111111100011111110000
0001111111000001111111100111111111100000111111111111111111110000011111111110001111111000001111111000
0011111110000000111111110111111111000000011111111111111111100000001111111110011111110000000111111100
0111111100000000011111111111111110000000001111111111111111000000000111111111111111100000000011111110
1111111000000000001111111111111100000000000111111111111110000000000011111111111111000000000001111111
0111111100000000000000000111111110000000000111111111111111000000000011111110000000000000000011111111
0011111110000000000000000111111111000000001111111111111111100000000111111110000000000000000111111110
0001111111000000000000000111111111100000011111111111111111110000001111111110000000000000001111111100
0000111111100000000000000111111111110000111111111111111111111000011111111110000000000000011111111000
0000011111110000000000000111111111111001111111111111111111111100111111111110000000000000111111110000
0000001111111000000000000111111111111111111111111111111111111111111111111110000000000001111111100000
0000000111111000000000000111111111111111111111111111111111111111111111111110000000000001111111000000
0000000011111000000000000111111111111111111111111111111111111111111111111110000000000001111110000000
0000000001111000000000000111111111111111111111111111111111111111111111111110000000000001111100000000
0000000000111000000000000111111111111111111111111111111111111111111111111110000000000001111000000000
0000000000011000000000000111111111111111111111111111111111111111111111111110000000000001110000000000
0000000000011000000000000111111111111111111111111111111111111111111111111110000000000001100000000000
0000000000011000000000000111111111111111111111111111111111111111111111111110000000000001100000000000
0000000000111000000000000111111111111111111111111111111111111111111111111110000000000001100000000000
0000000001111000000000000111111111111111111111111111111111111111111111111110000000000001110000000000
0000000011111000000000000111111111111111111111111111111111111111111111111110000000000001111000000000
0000000111111000000000000111111111111111111111111111111111111111111111111110000000000001111100000000
0000001111111000000000000111111111111111111111111111111111111111111111111110000000000001111110000000
0000011111111000000000000111111111111111111111111111111111111111111111111110000000000001111111000000
0000111111110000000000000111111111111011111111111111111111111101111111111110000000000000111111100000
0001111111100000000000000111111111110001111111111111111111111000111111111110000000000000011111110000
0011111111000000000000000111111111100000111111111111111111110000011111111110000000000000001111111000
0111111110000000000000000111111111000000011111111111111111100000001111111110000000000000000111111100
1111111100000000000000000111111110000000001111111111111111000000000111111110000000000000000011111110
1111111000000000001111111111111100000000000111111111111110000000000011111111111111000000000001111111
0111111100000000011111111111111110000000000111111111111111000000000011111111111111100000000011111110
0011111110000000111111100111111111000000001111111111111111100000000111111110111111110000000111111100
0001111111000001111111000111111111100000011111111111111111110000001111111110011111111000001111111000
0000111111100011111110000111111111110000111111111111111111111000011111111110001111111100011111110000
0000011111110111111100000111111111111001111111111111111111111100111111111110000111111110111111100000
0000001111111111111000000111111111111111111111111111111111111111111111111110000011111111111111000000
0000000111111111110000000111111111111111111111111111111111111111111111111110000001111111111110000000
0000000011111111100000000111111111111111111111111111111111111111111111111110000000111111111100000000
0000000001111111000000000111111111111111111111111111111111111111111111111110000000011111111000000000
0000000000111110000000000111111111111111111111111111111111111111111111111110000000001111110000000000
0000000000011100000000000111111111111111111111111111111111111111111111111110000000000111100000000000
0000000000001000000000000111111111111111111111111111111111111111111111111110000000000011000000000000
0000000000000000000000000000000000001100000000000000000000000110000000000000000000000000000000000000
0000000000011000000000000000000000011100000000000000000000001110000000000000000000000000000000000011
0000000000011000000000000000000000111100000000000000000000011110000000000000000000000000000000001111
0000000000111100000000000000000001111100000000000000000000111110000000000000000000000000000000111111
0000000000111100000000000000000011111100000000000000000001111110000000000000000000000000000011111111
0000000001111110000000000000000111111100000000000000000011111110000000000000000000000000001111111111
0000000001111110000000000000001111111100000000000000000111111110000000000000000000000000111111111111
0000000011111111000000000000011111111000000000000000001111111100000000000000000000000011111111111111
0000000011111111000000000000111111110000000000000000011111111000000000000000000000001111001111111111
0000000111111111100000000001111111100000000000000000111111110000000000000000000000111111000011111111
0000000111111111100000000011111111000000000000000001111111100000000000000000000011111111000000111111
0000001111111111110000000111111110000000000000000011111111000000000000000000001111111111000000001111
0000001111111111110000000111111100000000000111111111111110000000000011111110111111111111000000000011
0000011000000000011000000011111110000000001111111101111111000000000111111110111111111111000000000111
0000011100000000011000000001111111000000011111110000111111100000001111111000001111111111000000011111
0000111100000000111100000000111111100000111111100000011111110000011111110000000011111111000001111111
0000111110000000111100000000011111110001111111000000001111111000111111100000000000111111000111111111
0001111110000001111110000000001111111011111110000000000111111101111111000000000000001111011111111111
0001111111000001111110000000000111111111111100000000000011111111111110000000000000000011111111111111
0011111111000011111111000000000011111111111000000000000001111111111100000000000000000000111111111111
0011111111100011111111000000000001111111110000000000000000111111111000000000000000000000001111111111
0111111111100111111111100000000000111111100000000000000000011111110000000000000000000000000011111111
0111111111110111111111100000000000011111000000000000000000001111100000000000000000000000000000111111
1111111111111111111111110000000000001110000000000000000000000111000000000000000000000000000000001111
1111111111111111111111110000000000000100000000000000000000000010000000000000000000000000000000000011
\$\endgroup\$
4
\$\begingroup\$

PHP - 417 414 413 410 bytes, 0 errors, (2 0 warnings!)

PHP identicon

<?eval(preg_replace(['/[&|]/','/[a-z]/'],['$0$0','$$0'],"FOR(y=0,r=49+s=1+t=99;y<s;++y,PRINT'
')FOR(x=0;u=2*x-y,v=2*x+y,w=x-2*y,z=x+2*y,x<s;++x)ECHO-(w<-150&z<198|u>0&v<49|w>51&z>t|u<t&v>249|x<50&(w>26&z>49|z>74&(w>1|x<25&(w>-49|z>t&w>-74)))|y<50&(v>224&u<r|u<124&(v>199|y<25&(v>r|v>124&u<t)))|y>49&(v<74&u>-50|u>-25&(v<t|y>74&(v<r|v<174&u>0)))|x>49&(z<248&w<-125|z<223&(w<-s|x>74&(w<-50|w<-25&z<198))))+1;"));

Requires PHP>=5.4.

PHP allows its keywords to be any case so I have used uppercase for keywords and lowercase for variables within the golfed code. preg_replace is only used to ungolf the code and eval to run it. I removed $ from all variables and reinserted them with a regex. I also changed each instance of && and || to & and | and doubled them with a regex. I can't do the same trick for ++ because I also use + that I don't want doubled. I tried reversing the logic to get rid of the - just after echo but it changed too many 99s into 100s. However, I did manage to avoid using a single space!

I was able to apply Ismael Miguel's suggestion to the other set of {} braces for the for loop too, however, I had to use print instead of echo. print and echo are both language constructs ("magic" keywords that don't need parentheses ()) and are therefore not allowed inside a for declaration. However, since print has a return value like a function does, it is allowed inside the for. By moving the variable assignments from the third to the second section I was able to eliminate the warnings, too!

\$\endgroup\$
  • \$\begingroup\$ I've reduced 3 bytes from your answer. Here is a pastebin: pastebin.com/12JRtgGW (just ignore the warnings) \$\endgroup\$ – Ismael Miguel May 5 '15 at 23:06
  • \$\begingroup\$ Thanks @IsmaelMiguel! I've also reduced the number of errors to just 2 by rearranging the logic. \$\endgroup\$ – CJ Dennis May 6 '15 at 3:53
  • 2
    \$\begingroup\$ Can you include the color identicon image? And perhaps remove the bulky output text unless you really want it. :) \$\endgroup\$ – Calvin's Hobbies May 6 '15 at 5:35
  • 1
    \$\begingroup\$ @IsmaelMiguel I said the wrong thing, I meant warnings, not errors! My file originally had \r\n line endings but I changed it to just \n to save the one byte as you suggested. \$\endgroup\$ – CJ Dennis May 6 '15 at 9:09
  • 1
    \$\begingroup\$ Answers like this, that improve and go beyound the language limits, should have a double-upvote button. \$\endgroup\$ – Ismael Miguel May 6 '15 at 14:36
3
\$\begingroup\$

Pip, 116 bytes (96 errors)

Pip identicon

Newlines are for formatting purposes only and have no effect on the code:

l:24-_*2
b:1X25RL25
t:0Xl.1X25-lM,13
tAL:t@>1
g:(b@<13AL(1X12-_RL2J0X2*_+1M,12)).tALt.b
Fi,50Fj,50g@i.:(g50-j-1i)
PgJ:n
RVg

Slightly ungolfed with comments:

l: 24-_*2                               Lambda function for use in calculating t
b: (1 X 25) RL 25                       25x25 block of 1s
t: (0 X l).(1 X (25-l)) M ,13           One of the skinny white triangles
t AL: t@>1                              Append t[1:] to t, so as to have two triangles
w: (1 X 12-_) RL 2 J (0 X 2*_+1) M ,12  The white wedge shape
g: (b@<13 AL w).t AL t.b                Build top left quadrant
Fi ,50
 Fj ,50
  g@i .: g@(50-j-1)@i                   Copy, rotating, and add as top right quadrant
P(g J: n)                               Join on newline and print as top half
RV g                                    Reverse top half for bottom half (auto-printed)

The code builds the identicon as a list of strings. Once you know that X is string multiplication, RL is repeat list, AL append list, and J join, it's fairly readable (IMHO). The variables b, t, and w (in the ungolfed version) correspond to the following parts of the identicon:

Part 1 Part 2 Part 3

The top left quadrant is put together like so:

Wt
tb

where W represents 13 lines of b placed on top of w. We then rotate and reverse to get the rest of the figure.

The errors result from how we generate the skinny white triangles (second piece above). They're not exactly the same size--one has odd numbers of white pixels and the other has even numbers--but treating them as being the same (sans the top row of the bottom one, to total 25 rows) saves a few bytes. Here's a 122-byte version that does the even-odd stairstepping correctly (0 errors):

f:25
l:23-_*2+f*(_>12)
b:1XfRLf
t:(0Xl.1Xf-l)@<fM,f
g:(b@<13AL(1X12-_RL2J0X2*_+1M,12)).tALt.b
Fi,50Fj,50g@i.:(g50-j-1i)
PgJ:nRVg

And, just for fun, a Python translation of the original (not golfed):

l = lambda a: 24 - a * 2
b = ["1" * 25] * 25
t = list(map(lambda a: "0"*l(a) + "1"*(25-l(a)), range(13)))
t += t[1:]
w = list(map(lambda a: ("0"*(2*a+1)).join(["1"*(12-a)]*2), range(12)))
g = list(map(str.__add__, b[:13] + w, t)) + list(map(str.__add__, t, b))
for i in range(50):
    for j in range(50):
        g[i] += g[50-j-1][i]
g = "\n".join(g)
print(g)
print(g[::-1])
\$\endgroup\$
3
\$\begingroup\$

Ruby, 324 bytes, 216 errors

identicon for Ruby

Identicon uses the string Ruby, and I kind of like it. Pure geometry + symmetry. Edge equations for the triangle, rotation by 45゜ for the rectangles to make them axis aligned. About 100 errors have been sacrificed for a few bytes less.

A=[]
5.times{|b|0.upto(49){|j|b<2&&A<<[0]*50&&next
0.upto(49){|i|A[99-j][i]=A[j][99-i]=A[i][j]=A[99-i][99-j]=A[i][j]
i<25&&j>24?0:next
A[i][j]=2*j-i<50?0:j>37&&i>13&&j-i+2<26?0:1
b<3&&A[j-13][24-i]=A[i][j]
A[i+=25][j-25]=A[i-25][j]
x=i-j
y=i+j
A[i][j]=x>-7&&x<7&&y>67&&y<81||x<-12||x>12||y<63||y>86?1:0}}}
puts A.map(&:join)
\$\endgroup\$
3
\$\begingroup\$

///, 1319 bytes, 0 errors

enter image description here

/=/gD//_/QPG//-/NAN//)/N0M//(/M0F//*/LCL//&/GTQ//%/GRG//$/GIG//#/DPK//@/BcQ//!/BH//z/BAQ//y/CI//x/AP//w/ALOK//v/ALIL//u/NRM//t/CR//s/SRS//r/NPN//q/MIM//p/GcG//o/DAAD//n/CP//m/C0//l/1AFK//k/CT//j/CE//i/FAF//h/CH//g/CO//f/AO//e/FMHFM//d/FD//c/AH//b/FF//a/QH1HQ//Z/LHBHL//Y/KHGHK//X/DHMHD//W/1HSH1//V/BHKHB//U/JA//T/EE//S/F1//R/E0//Q/B1//P/IE//O/I0//N/G1//M/GD//L/DD//K/D1//J/CA//I/AE//H/A0//G/BD//F/BB//E/00//D/11//C/AAA//B/11111//A/00000/bBAIFKUbB
sfdUs
ifdUi
qxSUq
rxSUr
pCFUp
aCFUa
VmMUV
ZmMUZ
YjNUY
XjNUX
WtGUW
lnGUlH
WkQgKHSH1
XkQhQHMHD
YJBkMHGHK
ZJBjdH!L
VhLCFV
ahLfFNH1HQ
pyKcFScG
ryKPbLPN
q=IbGIM
i=Abi
sn1RbFKRS
d0dn10bFQ0d
AIFL=g1U
fd0DkK0DkKU
fd0*E*JH
xSE@R@JH
xSE$T$JI
CFRuAuJI
CFReJO
mMT)I)JO
mMT%O%JP
jNAzPzJP
jNvAvCC
tGH#c#CC
tGt1n1Cm
kQHocoJOD
kQwAwJHL
JBA!BP!BgQ
JBT&O&hN
hLTNENINENtF
hLRemd
yKR(A(fFL
yKE-T-cFQ
=E_R_OFN
=0BfBEBf!b
n10KjL0KjLRbD
nKhLhD0bL
bQ==n
bKRDkK0DkLn
FSA*E*0Dg
FMO@R@0Dg
FGAA$T$EKy
FBfuAuEKy
FKCeRLh
St)I)RLh
MJ%O%TBJ
GgzPzTBJ
BULILAvAQk
KJO#c#AQk
1CJI1n1HGt
CmocoAGt
CCLOKAwANj
CC!BP!BTNj
JP&O&TMm
JPNENINEum
JOeRFC
JO(A(EFC
JI-T-ESx
JI_R_0Sx
JHBfBEBfB0df
JHKjL0KjFQf
UDhLhFBAI
bbSnbB
SRbFLE1ns
FAbSTDgi
MIbNHDgq
NPbBOKyr
GcbDAAKyp
QH1HFMAILha
!KHFQxLhV
LH!FKmBJZ
KHGHFtBJY
DHMHGJQkX
1HSHLyQkW
lH1nGtlH
WUGtW
XUNjX
YUNjY
ZUMmZ
VUMmV
aUFCa
pUFCp
rUSxr
qUSxq
iUdfi
sUdfs
d0dUFKAId0d

Try it online!

This took me around 2 hours to make, because I was manually replacing stuff. The biggest thing I made in ///.

Probably I can golf a few more bytes.

Also, see Erik the Golfer's answer in /// (4 bytes shorter than mine).

\$\endgroup\$
2
\$\begingroup\$

Fortran, 214 bytes, 200 errors

Identicon for the string "Fortran"

Fortran may not be the first choice for code golf, but its identicon looked so simple that I thought I would give it a try. In fact I cannot compete with some of the terser languages, but using implicit variables and other such niceties (e.g., - doubles as xor), it is not so bad — I got it down to 214 bytes:

logical A(-12:87,-12:87)
do 1 r=-12,12
do 1 s=-12,12
x=abs(r)
y=abs(s)
l=x+y<6
k=(x<y/2+7.and.y<x/2+7)-l
A((/r+25,r+50/),(/s,s+75/))=k
A((/r,r+75/),(/s+25,s+50/))=k
1A((/r,r+75/),(/s,s+75/))=l
print'(100I1)',-A
end

Note: This will not work with gfortran. It compiles with ifort if you give the file a .f90 extension (this activates free form source).

\$\endgroup\$
2
\$\begingroup\$

Perl - 3244 3188 1609 1387 bytes, 0 13 66 78 errors

It took me a little while to realize it, but the icon is symmetrical. Also, I can just print a newline after every 100 characters rather than hard-coding it.

@i=qw(1;76 0;24 1;77 0;21 1;2 1;78 0;22 1;79 0;21 0;4 1;17 0;4 1;55 0;20 1;81 0;13 1;6 0;6 1;13 0;6 1;57 0;11 1;7 0;7 1;11 0;7 1;12 0;1 1;45 0;9 1;8 0;8 1;9 0;8 1;11 0;3 1;22 0;3 1;20 0;7 1;9 0;9 1;7 0;9 1;10 0;5 1;20 0;5 1;20 0;5 1;10 0;10 1;5 0;10 1;9 0;7 1;18 0;7 1;20 0;3 1;11 0;11 1;3 0;11 1;8 0;9 1;16 0;9 1;20 0;1 1;12 0;12 1;1 0;12 1;7 0;11 1;14 0;11 1;32 0;11 1;3 0;11 1;8 0;9 1;16 0;9 1;33 0;10 1;5 0;10 1;9 0;7 1;18 0;7 1;20 0;3 1;11 0;9 1;7 0;9 1;10 0;5 1;20 0;5 1;20 0;5 1;10 0;8 1;9 0;8 1;11 0;3 1;22 0;3 1;20 0;7 1;9 0;7 1;11 0;7 1;12 0;1 1;24 0;1 1;20 0;9 1;8 0;6 1;13 0;6 1;57 0;11 1;7 0;5 1;15 0;5 1;56 0;13 1;6 0;4 1;17 0;4 1;55 0;15 1;5 0;3 1;19 0;3 1;54 0;17 1;4 0;2 1;21 0;2 1;53 0;19 1;3 0;1 1;23 0;1 1;52 0;21 1;2 1;76 0;23 1;1 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25 1;12 0;1 1;12 0;50 1;12 0;1 1;12 1;11 0;3 1;11 0;50 1;11 0;3 1;11 1;10 0;5 1;10 0;50 1;10 0;5 1;10 1;9 0;7 1;9 0;50 1;9 0;7 1;9 1;8 0;9 1;8 0;50 1;8 0;9 1;8 1;7 0;11 1;7 0;50 1;7 0;11 1;7 1;8 0;9 1;8 0;50 1;8 0;9 1;8 1;9 0;7 1;9 0;50 1;9 0;7 1;9 1;10 0;5 1;10 0;50 1;10 0;5 1;10 1;11 0;3 1;11 0;50 1;11 0;3 1;11 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25 1;25 0;50 1;25);$n=0;for(@i,reverse@i){@p=split';';$n+=$p[1];print $p[0]x int($p[1]);if($n>=100){print"\n";$n=0}}

Generates the text for this:

Perl

\$\endgroup\$
  • \$\begingroup\$ Some easy saves: you don't need $n=0 nor int(); if($n>=100){print"\n";$n=0}$n>99and$n=!print"\n"; @p can be replaced by /(.*);(.*)/;$n+=$2;print$1x$2. \$\endgroup\$ – xebtl May 12 '15 at 0:43
2
\$\begingroup\$

///, 1315 bytes, 0 errors

///

/-/\/\///O/00000-I/11111-o/OOO-i/11-@/000-!/II-8/O0-|/Ii-*/O@-+/0|-_/i1-=/oO-#/ii-$/I1-%/|i-^/!1-&/*0-2/+1-3/=O-4/I8_8I-5/!!-6/#8I8#-7/$818$-9/18^81-A/_8|8_-B/i8%8i-C/o@-D/O8-d/o8-E/o0-F/|1-g/+i-H/O*-h/o*-j/!%8!%-k/!i-l/!O!-m/#80#-n/0_-p/1O!_-q/^@^-r/iOOi-s/0$-t/
=-u/%8g-v/o&-w/|D|-x/
F*2-y/#*_O-z/#o#0-Z/0IHI-Y/E0/5i_D0!_35I
qHk3q
lHk3l
uO&^3uxO&^3F*2
wo!3w
7o!37
4og34
6og36
AE23A
BE23B
9C|39
ph+3p8
9Csh_8^81
BCsd$8%8i
A=ICg8|8_
6=IYk8I8#
4d#o!4
7d#H!F818$
wdnD!^D|xdn&5#*2
uhi805|8g
lhiO5l
qv1@5!_@^
k0kv105!$0k
D0!#hih13
Hk0iCn0iCn3
Hk0z0#o#=8
O&^00ID$@ID$=8
O&^0+8+@+8+=80
o!@F@%OF@%=80
o!@j=*
og@2g82g=*
og@+@|*|@|=&
E2OIO$&IO$=&
E2OmOOmoo
C|8i&_Di&_oo
C|C1v1oE
Cs8rDr=*i
CsOyO#*_=8#tIOI8I&I8Ih$tI@+@s*|@sdF
d#@2028202C!
d#@jEk
dn@%0!O%0!H!#
dn02OF@2OFD!$
hi0s*+@$*+*!F
hiZ0Z85
v1nY#nY#@5i
v_d#di05#
5$hihiv
5_@iCn0iC0#v
!^Oz0zih
!%*ID$@ID$0ih
!|OO|8+@+8+0nd0
!IHF@%OF@%0nd0
!_oj@#d
^CFg82g@#d
%=|@|*|@|@0I=
|hIO$&IO$@0I=
I3mOOmO$C0
_=*i&_Di&_O$C0
1o=801v18|C
oErDrO|C
ooyOyFY
ooI8I&I8I@2Yt*+@s*|@s@gEt*2028202@%Et*j@!ot*%0!O%0!00!ot82OF@2OF00^O&t8s*+@$*+0^O&t8IHI0Z0kHt8_Y#nY!$H
3id#d!ID0
55^v5I
^@5!#001vq
!O5^@0ihl
%805F8ihu
F&5I*_d2*2
|D5iOO_d+D|
$818!%D0#d7
I8_8!$O&#d4
#8I8!_EI=6
_8|8!CI=A
i8%8|=$C0B
18^8#dsC09
p81h+Cp8
93|C9
B3FYB
A3FYA
63%E6
43%E4
73!o7
w3!owx3^H2*2
u3^Hg8g
l3kHl
q3kHq
k0k3!_D0k0k

Try it online!

This is the identicon for ///. It's possibly the biggest thing I've ever done in ///!

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

IDL 8.4, 333 bytes, 105 errors

This gave a different identicon, and I was able to golf it considerably more using an entirely different method.

IDL 8.4 identicon

b=byte('AKMLOJMLPIMLQHMLRGMLSFMLTEMLUDMLVCMLWBMLXAMLfLfLNKBWOJCVPIDUQHETRGFSSFGRTEHQUDIPVCJOWBKNXALMfLMLfLfLfLfLfLfLfLTLFLTLFLTLFLTLFLTLFLTLFLTLFLTLFLTLFLTLFLTLFLTLFLfLfLfLfLfLf')-64
f=[]
for i=1,169 do f=[f,replicate(i mod 2,b[i-1])]
f=reform(f,50,50)
print,[[rotate(f,4),rotate(f,5)],[rotate(f,7),rotate(f,6)]],format='(100I1)'
end

First, convert the characters in line 1 to byte values and subtract 64 (so that A = 1, B = 2, etc.). Then, stick those many consecutive 1s and 0s into a array, and reform it into 50x50 (i.e., the upper left quadrant, but transposed). Then, transpose & rotate it 4 times, stitch them together, and print it.

1111111111111111111111111000000000000000000000000011111111111110000000000001111111111111000000000001
0111111111111011111111111000000000000000000000000011111111111110000000000001111111111111000000000011
0011111111111001111111111000000000000000000000000011111111111110000000000001111111111111000000000111
0001111111111000111111111000000000000000000000000011111111111110000000000001111111111111000000001111
0000111111111000011111111000000000000000000000000011111111111110000000000001111111111111000000011111
0000011111111000001111111000000000000000000000000011111111111110000000000001111111111111000000111111
0000001111111000000111111000000000000000000000000011111111111110000000000001111111111111000001111111
0000000111111000000011111000000000000000000000000011111111111110000000000001111111111111000011111111
0000000011111000000001111000000000000000000000000011111111111110000000000001111111111111000111111111
0000000001111000000000111000000000000000000000000011111111111110000000000001111111111111001111111111
0000000000111000000000011000000000000000000000000011111111111110000000000001111111111111011111111111
0000000000011000000000001000000000000000000000000011111111111110000000000001111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111110000000000001111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111110000000000000000000000011000000000001
1111111111111011111111111111111111111111111111111111111111111110000000000000000000000111000000000011
1111111111111001111111111111111111111111111111111111111111111110000000000000000000001111000000000111
1111111111111000111111111111111111111111111111111111111111111110000000000000000000011111000000001111
1111111111111000011111111111111111111111111111111111111111111110000000000000000000111111000000011111
1111111111111000001111111111111111111111111111111111111111111110000000000000000001111111000000111111
1111111111111000000111111111111111111111111111111111111111111110000000000000000011111111000001111111
1111111111111000000011111111111111111111111111111111111111111110000000000000000111111111000011111111
1111111111111000000001111111111111111111111111111111111111111110000000000000001111111111000111111111
1111111111111000000000111111111111111111111111111111111111111110000000000000011111111111001111111111
1111111111111000000000011111111111111111111111111111111111111110000000000000111111111111011111111111
1111111111111000000000001111111111111111111111111111111111111110000000000001111111111111111111111111
0000000000000000000000000111111111111111111111111111111111111111111111111111111111111111000000000000
0000000000000000000000000111111111111111111111111111111111111111111111111111111111111111000000000000
0000000000000000000000000111111111111111111111111111111111111111111111111111111111111111000000000000
0000000000000000000000000111111111111111111111111111111111111111111111111111111111111111000000000000
0000000000000000000000000111111111111111111111111111111111111111111111111111111111111111000000000000
0000000000000000000000000111111111111111111111111111111111111111111111111111111111111111000000000000
0000000000000000000000000111111111111111111111111111111111111111111111111111111111111111000000000000
0000000000000000000000000111111100000000000011111111111100000000000011111111111111111111000000000000
0000000000000000000000000111111100000000000011111111111100000000000011111111111111111111000000000000
0000000000000000000000000111111100000000000011111111111100000000000011111111111111111111000000000000
0000000000000000000000000111111100000000000011111111111100000000000011111111111111111111000000000000
0000000000000000000000000111111100000000000011111111111100000000000011111111111111111111000000000000
1111111111111111111111111111111100000000000011111111111100000000000011111111111111111111000000000000
1111111111111111111111111111111100000000000011111111111100000000000011111111111111111111000000000000
1111111111111111111111111111111100000000000011111111111100000000000011111111111111111111000000000000
1111111111111111111111111111111100000000000011111111111100000000000011111111111111111111000000000000
1111111111111111111111111111111100000000000011111111111100000000000011111111111111111111000000000000
1111111111111111111111111111111100000000000011111111111100000000000011111111111111111111000000000000
1111111111111111111111111111111100000000000011111111111100000000000011111111111111111111000000000000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000
0000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
0000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
0000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
0000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
0000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
0000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
0000000000001111111111111111111100000000000011111111111100000000000011111111111111111111111111111111
0000000000001111111111111111111100000000000011111111111100000000000011111111111111111111111111111111
0000000000001111111111111111111100000000000011111111111100000000000011111111111111111111111111111111
0000000000001111111111111111111100000000000011111111111100000000000011111111111111111111111111111111
0000000000001111111111111111111100000000000011111111111100000000000011111111111111111111111111111111
0000000000001111111111111111111100000000000011111111111100000000000011111111111111111111111111111111
0000000000001111111111111111111100000000000011111111111100000000000011111111111111111111111111111111
0000000000001111111111111111111100000000000011111111111100000000000011111110000000000000000000000000
0000000000001111111111111111111100000000000011111111111100000000000011111110000000000000000000000000
0000000000001111111111111111111100000000000011111111111100000000000011111110000000000000000000000000
0000000000001111111111111111111100000000000011111111111100000000000011111110000000000000000000000000
0000000000001111111111111111111100000000000011111111111100000000000011111110000000000000000000000000
0000000000001111111111111111111111111111111111111111111111111111111111111110000000000000000000000000
0000000000001111111111111111111111111111111111111111111111111111111111111110000000000000000000000000
0000000000001111111111111111111111111111111111111111111111111111111111111110000000000000000000000000
0000000000001111111111111111111111111111111111111111111111111111111111111110000000000000000000000000
0000000000001111111111111111111111111111111111111111111111111111111111111110000000000000000000000000
0000000000001111111111111111111111111111111111111111111111111111111111111110000000000000000000000000
0000000000001111111111111111111111111111111111111111111111111111111111111110000000000000000000000000
1111111111111111111111111000000000000111111111111111111111111111111111111111000000000001111111111111
1111111111101111111111110000000000000111111111111111111111111111111111111111100000000001111111111111
1111111111001111111111100000000000000111111111111111111111111111111111111111110000000001111111111111
1111111110001111111111000000000000000111111111111111111111111111111111111111111000000001111111111111
1111111100001111111110000000000000000111111111111111111111111111111111111111111100000001111111111111
1111111000001111111100000000000000000111111111111111111111111111111111111111111110000001111111111111
1111110000001111111000000000000000000111111111111111111111111111111111111111111111000001111111111111
1111100000001111110000000000000000000111111111111111111111111111111111111111111111100001111111111111
1111000000001111100000000000000000000111111111111111111111111111111111111111111111110001111111111111
1110000000001111000000000000000000000111111111111111111111111111111111111111111111111001111111111111
1100000000001110000000000000000000000111111111111111111111111111111111111111111111111101111111111111
1000000000001100000000000000000000000111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111000000000000111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111000000000000111111111111100000000000000000000000001000000000001100000000000
1111111111101111111111111000000000000111111111111100000000000000000000000001100000000001110000000000
1111111111001111111111111000000000000111111111111100000000000000000000000001110000000001111000000000
1111111110001111111111111000000000000111111111111100000000000000000000000001111000000001111100000000
1111111100001111111111111000000000000111111111111100000000000000000000000001111100000001111110000000
1111111000001111111111111000000000000111111111111100000000000000000000000001111110000001111111000000
1111110000001111111111111000000000000111111111111100000000000000000000000001111111000001111111100000
1111100000001111111111111000000000000111111111111100000000000000000000000001111111100001111111110000
1111000000001111111111111000000000000111111111111100000000000000000000000001111111110001111111111000
1110000000001111111111111000000000000111111111111100000000000000000000000001111111111001111111111100
1100000000001111111111111000000000000111111111111100000000000000000000000001111111111101111111111110
1000000000001111111111111000000000000111111111111100000000000000000000000001111111111111111111111111
\$\endgroup\$
1
\$\begingroup\$

Bubblegum, 535 bytes, 0 errors

enter image description here

0000000: bd96 410a 4431 0843 f739 4d73 ffcb cdf2  ..A.D1.C.9Ms....
0000010: 93a1 0f2a 04b3 ab22 b1ad 1acf 07fb c489  ...*..."........
0000020: 70ee 7006 9f0f 0207 b31c 60b1 33d4 3792  p.p.......`.3.7.
0000030: b033 4b24 03b9 dbc9 2220 2796 6b36 9f31  .3K$...." '.k6.1
0000040: c3fe 49d2 8a2c 904e d8fc 2149 d288 2c90  ..I..,.N..!I..,.
0000050: 4f98 9c01 1f49 da90 0512 0a8b 131f 0914  O....I..........
0000060: 275c 3e8e 61a0 0756 384e 00be 9148 8da5  '\>.a..V8N...H..
0000070: a25b ae09 4adc cea3 b1e8 75e2 cc2c f080  .[..J.....u..,..
0000080: 71a2 f655 1e91 056a 210e 0822 4938 0e63  q..U...j!.."I8.c
0000090: 346f 7208 d53f 2174 ab0b 50ed 1342 b5e3  4or..?!t..P..B..
00000a0: 01dd d905 e84e 6142 554f 0855 6524 5435  .....NaBUO.Ue$T5
00000b0: 1ed0 dd56 086a ee5d 04b9 0666 d7a1 801a  ...V.j.]...f....
00000c0: 8b2d fedf 128b 6d71 a54e c1ed 2cee b939  .-....mq.N..,..9
00000d0: a8d5 c4d3 630c 9c37 e239 3806 4e4e e144  ....c..7.98.NN.D
00000e0: e752 6307 6880 509b b80c d801 696a aeb2  .Rc.h.P.....ij..
00000f0: 7387 705c 635e e4e0 2b8a 0629 ab2c 39f8  s.p\c^..+..).,9.
0000100: b384 230e 6b85 1c8c ed9b f4ff 64b1 ba16  ..#.k.......d...
0000110: fa64 a1e3 7766 d7f2 145e d093 0565 5cd0  .d..wf...^...e\.
0000120: f89d 6d65 67ef 424f 11b2 6b1c 87ec c2df  ..meg.BO..k.....
0000130: 9a03 6b48 5877 7360 3708 3b68 0eec 6be1  ..kHXws`7.;h..k.
0000140: 2c98 0327 94e6 628a c059 abb1 98b2 0355  ,..'..b..Y.....U
0000150: 4363 3165 07ea 9f8a 2a8b 4aae b198 b203  Cc1e....*.J.....
0000160: 7712 8dc5 941d b85d 692c a6ec c03d 71fd  w......]i,...=q.
0000170: 26fd 3f59 acae 853e 59e8 f89d d9b5 3c85  &.?Y...>Y.....<.
0000180: 17f4 6441 1917 347e 655b d9d9 bb0e 61cc  ..dA..4~e[....a.
0000190: 1e01 7162 129b cccc 11a9 bc91 98ac cc11  ..qb............
00001a0: f77d 2331 199d a056 7b23 c150 e4c8 9f7b  .}#1...V{#.P...{
00001b0: 2331 999c 8068 bf91 982c c891 ee37 1293  #1...h...,...7..
00001c0: 0139 d2fb 4662 38a7 01a3 fd40 3250 5988  .9..Fb8....@2PY.
00001d0: f61b 89e9 7198 2315 9349 5865 b161 21da  ....q.#..IXe.a!.
00001e0: f218 3ce0 e624 cd9b d0b8 2bff 896f a857  ..<..$....+..o.W
00001f0: d795 a3de 2737 8e7e c73b 519f 5d10 d29e  ....'7.~.;Q.]...
0000200: c270 f9b2 9ef0 bfb6 9531 2f58 d678 20ef  .p.......1/X.x .
0000210: 6e2b e0e8 ee5d 3f                        n+...]?

Compressed using zopfli (--deflate --i10000). Try it online.

Fairly straightforward; I might experiment with adding some errors later.

\$\endgroup\$
0
\$\begingroup\$

ForceLang, 2749 2499 2495 bytes

Noncompeting, language postdates the question.

def S set
S W io.writeln
S R string.rev
S a ""+0x6D79F82328EA3DA61E0701C9182D91DDE8B1C71C7
S b ""+0x786C90F379CE770387732B1CDC3135DC3CE1C71C6
S c ""+0x7984D36EB5187CC012312A961B9A27CB5BF9C71BC
S d ""+0x79A0DA14A16CB0862210C8BE24D40F55C1D5C7158
S e ""+0x79A3A78B9F751C1A0472203FA900BFF60DEBC6D70
S f ""+0x79A3EF4AB8DC5A0FFC9CDC4D56BD69F1DBBAC4660
S g ""+0x79A3F6776E99E049FE5189BC60823AF3FB1C2BFC0
S h ""+0x79A3F72F1A60079DE42E0BC3623C9CC0D0A4F7D80
S i ""+0x79A3F741785A41CCDA794C67E9EBDAB9EAC2CE700
S j ""+0x79A3F7434E8CFFB9AC2E70DEA901D141036760600
S k ""+0x79A3F7437D9343C8FBEF208311B066CF95614BC00
S l ""+0x79A3F7438253021069541D3C0D7DBD353F18E9800
S m ""+0x79A3F74382CB60F176B1C1A99D8D000C45AA51000
W a+a
W b+b
W c+c
W d+d
W e+e
W f+f
W g+g
W h+h
W i+i
W j+j
W k+k
W l+l
W m+m
W l+l
W k+k
W j+j
W i+i
W h+h
W g+g
W f+f
W e+e
W d+d
W c+c
W b+b
W a+a
W S n ""+0x2082FAED7A3F16F730463D6FB0529164157A6772E72577EC590ADCDD251957F2BC21BCECCEDA1000001
W S o "0"+0x3404C4AF29FE8B251A078D51F3422C44257DE9CCEE48C93AB6DDD70037D6F058EF1E96AE389780000B
W S p "00"+0x533AD44B766411D4F4ED5F3E08CDC08896ADBCDC1213E71D9792DAFE2655B4B0D387777F349C0006F
W S q "000"+0x852AED458A39B62094B066CF194EDEE006289DFD2093DCC403A9A369F588AB436E4125B928600457
W S r "0000"+0xD5117BA276C2BC68EEC80E4BF8D5C1A068B3ABB7496F715789D4298974E6B48DA0883E68B702B67
W S s "00000"+0x154E8C5D0BE0401A871156A755E768D3BEF3334F8FA7C61A4F116CE6907EB4964CFA6EB1559B207
W S t "000000"+0x221746FB462FE3C989A43900F01111A46D39389143FAB11D7C222D858D8B7420DC570C3CCCF447
W S u "0000000"+0x368BA4C53AC7AFE49E5162CA0DA3D0B1C8CDBE64A8195738CB712D2038B74223F9C849AEF8AC7
W S v "00000000"+0x5745D46D515CD860B238C63288EE96F8425A28BBF8CE27A5F060FE9F8B742263237710A66BC7
W S w "000000000"+0x8BA2EC93C7B8B205605DCC1242ACE73FE320C62A60CEC941E4474B78B742266B0F5F107B5C7
W S x "0000000000"+0xDF6A832B1C8B32B27AA702FBBFD960651EAB9E37CE30AD4E093DA78B7422670BEB558DD9C7
W S y "00000000000"+0x1651C9F6F18C5FB47C580D61E4F69EB8CFDD04644901F0B5CFB5078B742267151AEC7761C7
W S z "000000000000"+0x202C1796B182D85E5704E2B93930E38C74A50C6F9CC338492A1C78B7422671603C11C71C7
W y
W x
W w
W v
W u
W t
W s
W r
W q
W p
W o
W n
W R n
W R o
W R p
W R q
W R r
W R s
W R t
W R u
W R v
W R w
W R x
W R y
W R z
W R y
W R x
W R w
W R v
W R u
W R t
W R s
W R r
W R q
W R p
W R o
W R n
W S a R a+a
W S b R b+b
W S c R c+c
W S d R d+d
W S e R e+e
W S f R f+f
W S g R g+g
W S h R h+h
W S i R i+i
W S j R j+j
W S k R k+k
W S l R l+l
W R m+m
W l
W k
W j
W i
W h
W g
W f
W e
W d
W c
W b
W a
\$\endgroup\$

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.