{"id":1417,"date":"2009-04-13T14:24:54","date_gmt":"2009-04-13T13:24:54","guid":{"rendered":"http:\/\/www.craigmurphy.com\/blog\/?p=1417"},"modified":"2009-04-16T10:31:53","modified_gmt":"2009-04-16T09:31:53","slug":"programming-challenge","status":"publish","type":"post","link":"http:\/\/www.craigmurphy.com\/blog\/?p=1417","title":{"rendered":"Programming Challenge!"},"content":{"rendered":"<p>Twenty years ago, during my first year in academia, my Pascal tutor set us some top-notch assignments.  <\/p>\n<p><strong>Your mission:<\/strong><\/p>\n<blockquote><p>Write a program which draws a diamond of the form illustrated below.  The letter which is to appear at the widest point of the figure (E in the example) is to be specified as input data.<\/p><\/blockquote>\n<p>Here&#8217;s a scan of the original hand-out:<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.craigmurphy.com\/blog\/wp-content\/uploads\/2009\/04\/diamond.jpg\"  \/><\/p>\n<p>My original Pascal solution, which I prototyped using BBC Basic V, took less than a page of fan-fold listing paper and was implemented as a console application.  50% of the listing dealt with input validation and &#8220;do you want to run the program again?&#8221; code!  I will convert the example line-by-line into C# for later publication here!  Of course, were I to write it today, it should look very different!<\/p>\n<p>I&#8217;d be keen to see your solutions, written in your choice of programming language.  Novelty value for uniqueness in your choice of programming language may well be rewarded!  Procedural, object-oriented, functional, dynamic, verbose, terse&#8230;the choice is yours!<\/p>\n<p><strong>&#8220;What&#8217;s in it for me?&#8221; you might ask?<\/strong><br \/>\nWell, nothing really, a bit of kudos and the feeling of a job well done!  However, I will offer the two best\/novel UK-based solutions a much-coveted <a href=\"http:\/\/developerdeveloperdeveloper.com\/\">DDD<\/a> polo shirt (modelled <a href=\"http:\/\/www.flickr.com\/photos\/craigmurphy\/325421632\/\">here<\/a>!).  My decision is final, colour may vary, size might not be the same size as you, yada yada, other legalese applies, etc. <\/p>\n<p>Submission by comments here on this post, by e-mail (top right About Me), or via <a href=\"http:\/\/www.twitter.com\/camurphy\">Twitter @camurphy<\/a> please!<\/p>\n<p>Over to you!<\/p>\n<p>UPDATE: Comments seem to mangle the code formatting, it has been suggested that code is submitted either via e-mail or via <a href=\"http:\/\/pastebin.com\/\">http:\/\/pastebin.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Twenty years ago, during my first year in academia, my Pascal tutor set us some top-notch assignments. Your mission: Write a program which draws a diamond of the form illustrated below. The letter which is to appear at the widest point of the figure (E in the example) is to be specified as input data. &hellip; <a href=\"http:\/\/www.craigmurphy.com\/blog\/?p=1417\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Programming Challenge!<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,3],"tags":[421,422,423,420],"class_list":["post-1417","post","type-post","status-publish","format-standard","hentry","category-community","category-development","tag-challenge","tag-diamond","tag-pascal","tag-programming"],"_links":{"self":[{"href":"http:\/\/www.craigmurphy.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.craigmurphy.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.craigmurphy.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.craigmurphy.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.craigmurphy.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1417"}],"version-history":[{"count":3,"href":"http:\/\/www.craigmurphy.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1417\/revisions"}],"predecessor-version":[{"id":1429,"href":"http:\/\/www.craigmurphy.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1417\/revisions\/1429"}],"wp:attachment":[{"href":"http:\/\/www.craigmurphy.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.craigmurphy.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1417"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.craigmurphy.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}