{"id":92,"date":"2008-11-13T00:00:58","date_gmt":"2008-11-13T07:00:58","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=117"},"modified":"2008-11-13T00:00:58","modified_gmt":"2008-11-13T07:00:58","slug":"alphabet-with-base36-and-binary","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=92","title":{"rendered":"Alphabet with Base36 and Binary"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nvar canvas:BitmapData=new BitmapData(280,100,false,0xefefef);\r\naddChild(new Bitmap(canvas));\r\n\r\n\/\/ pixel alphbet in base36\r\nvar alphabet:Array=&#x5B;&quot;&quot;, &quot;67erkgi&quot;, &quot;e3j6dss&quot;, &quot;75rue4u&quot;, &quot;c5ltok8&quot;, &quot;75s2tji&quot;, &quot;75s2tjk&quot;, &quot;75rugj2&quot;, &quot;95yfnf6&quot;, &quot;21blls4&quot;, &quot;10nt5xo&quot;, &quot;973it1u&quot;, &quot;85aef4u&quot;, &quot;59lu6nl&quot;, &quot;cnz0hbn&quot;, &quot;67ej51o&quot;, &quot;67eq49c&quot;, &quot;67ej53e&quot;, &quot;67eq7gy&quot;, &quot;66978m4&quot;, &quot;6ywdqpw&quot;, &quot;95y780c&quot;, &quot;53b00as&quot;, &quot;8nmdpyi&quot;, &quot;5374thm&quot;, &quot;53avnus&quot;, &quot;6xsfdam&quot;];\r\n\r\nfunction drawBase36(num:String, xp:int, yp:int):void {\r\n\t\/\/ convert base36 to binary\r\n\tnum=parseInt(num,36).toString(2);\r\n\twhile (num.length &lt; 35) {\r\n\t\tnum=&quot;0&quot;+num;\r\n\t}\r\n\t\/\/ draw letter\r\n\tfor (var i:int= 0; i&lt;35; i++) {\r\n\t\tif (num.charAt(i)==&quot;1&quot;) {\r\n\t\t\tcanvas.setPixel(i % 5 + xp, int(i \/ 5) + yp, 0x000000);\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\/\/ draw the entire alphabet\r\nfor (var i:int = 0; i&lt;alphabet.length; i++) {\r\n\tdrawBase36(alphabet&#x5B;i], i * 10,10);\r\n}\r\n\r\n\/\/ draw some words\r\nvar words:Array=&#x5B;0,1,3,20,9,15,14,19,14,9,16,16,5,20,0,9,19,0,3,15,4,5];\r\nfor (i = 0; i&lt;words.length; i++) {\r\n\tdrawBase36(alphabet&#x5B;words&#x5B;i]], i * 10,30);\r\n}\r\n<\/pre>\n<p>I had lots of fun writing this. If you run it in your timeline it will draw this:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.actionsnippet.com\/imgs\/alphabet.gif\" \/><br \/>\n&#8230; along with the message stored in this array [0,1,3,20,9,15,14,19,14,9,16,16,5,20,0,9,19,0,3,15,4,5]. <\/p>\n<p>Binary can be used for representing small images. For every 0 draw white for every 1 draw black. So when the base36 numbers are converted to binary, the 1&#8217;s and 0&#8217;s are used to draw each letter. <\/p>\n<p>An interesting side note is that counting in binary to some very high numbers will enumerate all possible two color images at a given size. There are tons of projects related to this&#8230; here is one I found with a quick google search: <a href=\"http:\/\/www.numeral.com\/appletsoftware\/eicon.html\" target=\"_blank\">every icon<\/a><\/p>\n<p>I also found the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Base_36\">wikipedia entry<\/a> on base36 to be interesting. Apparently base36 can be called hexatridecimal, sexatrigesimal, hexatrigesimal or alphadecimal.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>var canvas:BitmapData=new BitmapData(280,100,false,0xefefef); addChild(new Bitmap(canvas)); \/\/ pixel alphbet in base36 var alphabet:Array=&#x5B;&quot;&quot;, &quot;67erkgi&quot;, &quot;e3j6dss&quot;, &quot;75rue4u&quot;, &quot;c5ltok8&quot;, &quot;75s2tji&quot;, &quot;75s2tjk&quot;, &quot;75rugj2&quot;, &quot;95yfnf6&quot;, &quot;21blls4&quot;, &quot;10nt5xo&quot;, &quot;973it1u&quot;, &quot;85aef4u&quot;, &quot;59lu6nl&quot;, &quot;cnz0hbn&quot;, &quot;67ej51o&quot;, &quot;67eq49c&quot;, &quot;67ej53e&quot;, &quot;67eq7gy&quot;, &quot;66978m4&quot;, &quot;6ywdqpw&quot;, &quot;95y780c&quot;, &quot;53b00as&quot;, &quot;8nmdpyi&quot;, &quot;5374thm&quot;, &quot;53avnus&quot;, &quot;6xsfdam&quot;]; function drawBase36(num:String, xp:int, yp:int):void { \/\/ convert base36 to binary num=parseInt(num,36).toString(2); while (num.length &lt; 35) { num=&quot;0&quot;+num; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,25,21],"tags":[50,51,52,53,54],"class_list":["post-92","post","type-post","status-publish","format-standard","hentry","category-bitmapdata","category-pixel-manipulation","category-strings","tag-alphabet","tag-base36","tag-hexatridecimal","tag-hexatrigesimal","tag-sexatrigesimal"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/92","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=92"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/92\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=92"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=92"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=92"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}