In this challenge, we will together create a word-search containing many programs in different languages.
I have started us off with a grid of 60-by-25 blanks (·
), some of which are replaced by the characters of a Ruby program.
To answer, choose a language that was not yet used. Using your chosen language, write a program that reads a character, token, line, or all input from the console, and prints it. Then, insert your program into the word-search.
For example, suppose you choose Python 3 for your answer, and write the program print(input())
. Now you have to insert that program into the grid.
If the grid before your answer looks like this:
···a·24··········
··z····t·········
Then you can just put your program in the second line, overlapping with the existing t
:
···a·24··········
··zprint(input())
Note that you can place your program in any direction: forward, backward, upward, downward, or diagonally, as long as it's in a straight line.
But what if the existing grid looks like this:
···a·24··········
··z····q·········
There's no way to fit the print(input())
here without changing existing characters, which is forbidden. Instead, you can change the program:
print(
input())
This two-line program fits neatly:
···a·24·print(···
··z····q input())
Here you replace a blank (·
) with a space (). However, a space is just like any other character, and can not be overwritten in future programs.
Just like a one-liner, a multi-line program can be placed in any direction. For example, in a larger grid, you could do the following, by rotating the program 135° clockwise.
··········
········ ·
·······i·p
······n·r·
·····p·i··
····u·n···
···t·t····
··(·(·····
·)········
)·········
Scoring
Your score for each answer is thirty divided by the number of characters added. Do not count characters that already existed in the grid, even if you use them yourself.
Your total score is the sum of the scores for all of your answers, multiplied by the number of answers. Highest score wins.
Rules
- Every answer must be written in a different language. Languages that differ only in version number (e.g., Python 2 and Python 3) are considered the same.
- Every answer must build off of the most recent valid answer. That is, take the grid of the most recent such answer, and insert your program into it.
- To insert your program, replace at least one of the blanks (
·
) with characters of your choice. You may use existing characters from the grid in your answer, but you may not change or move any of them. - You may not insert more than 500 characters in total, across all your answers.
- All characters you insert must be part of your program.
- Your program may consist only of printable ASCII and newlines, but there may not be two or more consecutive newlines back-to-back.
- Newlines do not count towards your score.
- A full program, not just a function or snippet, is required.
- The same user may not write two consecutive answers.
- If someone's answer violates a rule, leave a comment. If the mistake is not fixed in 30 minutes, it should be deleted.
Used language snippet
This is a Stack Snippet, made by ETHproductions, FryAmTheEggman, and Mauris, that keeps track of users' scores and the used languages. It was originally copied from Martin Büttner's amazing template.
Original leaderboard:
function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,r){return"http://api.stackexchange.com/2.2/answers/"+r.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var r=+e.share_link.match(/\d+/);answer_ids.push(r),answers_hash[r]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[],r={},x={};answers.forEach(function(s){var a=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(a="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var n=a.match(SCORE_REG);if(n){var t=getAuthorName(s);e.push({user:getAuthorName(s),size:+n[2],language:n[1],link:s.share_link}),r[t]=r[t]||0,r[t]+=30/+n[2],x[t]=x[t]||0,x[t]++}});Object.keys(r).forEach(function(e){r[e]*=x[e]});var s=Object.keys(r).sort(function(e,s){return r[s]-r[e]});e.sort(function(e,r){var s=e.size,a=r.size;return s-a});var a={},t=null;e.forEach(function(e){t=e.size;var r=e.language;/<a/.test(r)&&(r=jQuery(r).text()),a[r]=a[r]||{lang:e.language,user:e.user,size:e.size,link:e.link}});for(var c=0,o=1;c<s.length;c++){var i=jQuery("#author-template").html();r[s[c]]!==r[s[c-1]]&&(o=c+1);i=i.replace("{{PLACE}}",o+'.').replace("{{NAME}}",s[c]).replace("{{SCORE}}",r[s[c]].toFixed(2)),jQuery("#authors").append(jQuery(i))}var u=[];for(var m in a)a.hasOwnProperty(m)&&u.push(a[m]);u.sort(function(e,r){var s=e.lang.replace(/<.*?>/g,"").toLowerCase(),a=r.lang.replace(/<.*?>/g,"").toLowerCase();return s>a?1:a>s?-1:0});for(var l=0;l<u.length;++l){var h=jQuery("#language-template").html(),m=u[l];h=h.replace("{{LANGUAGE}}",m.lang).replace("{{NAME}}",m.user).replace("{{SIZE}}",m.size).replace("{{LINK}}",m.link),h=jQuery(h),jQuery("#languages").append(h)}}var QUESTION_ID=57327,ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",OVERRIDE_USER=16294,answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#author-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="author-list"> <h2>Leaderboard</h2> <table class="author-list"> <thead> <tr><td></td><td>Author</td><td>Score</td></tr></thead> <tbody id="authors"> </tbody> </table> </div><div id="language-list"> <h2>Languages</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="author-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{SCORE}}</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>
New (experimental) version, using a modified formula:
function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,r){return"http://api.stackexchange.com/2.2/answers/"+r.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var r=+e.share_link.match(/\d+/);answer_ids.push(r),answers_hash[r]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[],r={},x={};answers.forEach(function(s){var a=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(a="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var n=a.match(SCORE_REG);if(n){var t=getAuthorName(s);e.push({user:getAuthorName(s),size:+n[2],language:n[1],link:s.share_link}),r[t]=r[t]||0,r[t]+=30/+n[2]+20,x[t]=x[t]||0,x[t]++}});var s=Object.keys(r).sort(function(e,s){return r[s]-r[e]});e.sort(function(e,r){var s=e.size,a=r.size;return s-a});var a={},t=null;e.forEach(function(e){t=e.size;var r=e.language;/<a/.test(r)&&(r=jQuery(r).text()),a[r]=a[r]||{lang:e.language,user:e.user,size:e.size,link:e.link}});for(var c=0,o=1;c<s.length;c++){var i=jQuery("#author-template").html();r[s[c]]!==r[s[c-1]]&&(o=c+1);i=i.replace("{{PLACE}}",o+'.').replace("{{NAME}}",s[c]).replace("{{SCORE}}",r[s[c]].toFixed(2)),jQuery("#authors").append(jQuery(i))}var u=[];for(var m in a)a.hasOwnProperty(m)&&u.push(a[m]);u.sort(function(e,r){var s=e.lang.replace(/<.*?>/g,"").toLowerCase(),a=r.lang.replace(/<.*?>/g,"").toLowerCase();return s>a?1:a>s?-1:0});for(var l=0;l<u.length;++l){var h=jQuery("#language-template").html(),m=u[l];h=h.replace("{{LANGUAGE}}",m.lang).replace("{{NAME}}",m.user).replace("{{SIZE}}",m.size).replace("{{LINK}}",m.link),h=jQuery(h),jQuery("#languages").append(h)}}var QUESTION_ID=57327,ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",OVERRIDE_USER=16294,answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#author-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="author-list"> <h2>Leaderboard</h2> <table class="author-list"> <thead> <tr><td></td><td>Author</td><td>Score</td></tr></thead> <tbody id="authors"> </tbody> </table> </div><div id="language-list"> <h2>Languages</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="author-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{SCORE}}</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>
To ensure your submission is recognized by the snippet, please use the following header template:
# Language, X characters added