35
9
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
Thanks to Peter Taylor and trichoplax for their help and ideas.
– Ypnypn – 2015-09-08T19:27:27.193,.
works in very many BrainFuck derivatives, but I don't see any rule that bans anyone from just extending a,.
program with a random nop and calling it a valid (whatever derivative) submission. – Lynn – 2015-09-09T02:25:29.620Famously, yes. Esoteric language designers aren't very creative. The esolangs people are grumpy about it. – Lynn – 2015-09-09T03:14:07.237
2Eh, I would just rely on the community being cool enough not to do something that boring :) – Lynn – 2015-09-09T03:20:23.370
5I have a basic "leaderboard" snippet set up, copied from Martin's amazing template, that keeps track of the used languages. May I edit it into the post? – ETHproductions – 2015-09-09T03:24:43.240
I don't feel like anyone would object to it! – Lynn – 2015-09-09T03:33:00.200
1Alright, I've added the snippet. I only removed the unnecessary HTML portion, so feel free to shorten the CSS or JS. – ETHproductions – 2015-09-09T03:39:24.767
1@ETHproductions Nice, but could you fix it so that the sorting is not case sensitive, and also not sensitive to links in the language name? :) – daniero – 2015-09-09T08:43:08.753
@daniero I'll try, but I can't guarantee I'll actually fix it. – ETHproductions – 2015-09-09T13:22:19.557
@ETHproductions I think the links start with
<
from<a href=...</a>
? This would make sense with the7
being sorted before them. Sadly removing this<
character when sorting doesn't work as you get the lower casea
. I think we need a fancy regex? – FryAmTheEggman – 2015-09-09T13:48:50.230@FryAmTheEggman Yes, you are correct. I'm working on a fancy regex, but I'm having some trouble with it. Currently it detects the ones with links and replaces the entire thing with
""
.... – ETHproductions – 2015-09-09T13:59:05.557@ETHproductions I think I got a working one, please ping me if there are bugs, anyone! – FryAmTheEggman – 2015-09-09T14:02:27.583
I got one too, let me see about yours.... EDIT: Looks good, thanks for the help! – ETHproductions – 2015-09-09T14:02:43.673
I'm having a hard time finding the location of programs in the word find. Could each poster maybe say what direction it goes and where in the grid it is? – mbomb007 – 2015-09-09T14:04:56.337
1@mbomb007 IMHO, that's a good idea, but it would take a while to edit each of the 58 answers we have so far. Perhaps we could enforce this on the newer answers? It'll need to be done anyway when the word search is complete. – ETHproductions – 2015-09-09T15:17:54.163
The “printable ASCII only” rule discriminates against Funciton, Sclipting and Ziim, two of which would otherwise have a nice non-empty entry :( Why do you people hate Unicode? – Timwi – 2015-09-09T20:47:38.467
1Most programming languages don't use Unicode in their syntax, so they are a lot harder to fit into a word search without sticking out like a sore thumb and being impossible to cross with other words. Also, Sclipting's characters are wider than ASCII characters even in a monospace font. – Lynn – 2015-09-09T22:51:12.910
2I would suggest that the next time someone does something like this that they limit it to languages notable enough to have a Wikipedia entry, or something like that. It doesn't really feel like a real word search with dozens of one-two character entries from esoteric languages no one has ever heard of. – ThaddeusB – 2015-09-09T23:36:34.413
@ThaddeusB That's a good point, though it's hard to find a good place to draw the line. There are also many interesting languages that don't have Wikipedia articles. – Ypnypn – 2015-09-09T23:40:32.767
3Someone should extend the snippet to have a leaderboard listing the scores per author. – Lynn – 2015-09-10T02:42:34.817
1I really want to see an answer written in whitespace. – MarcDefiant – 2015-09-10T14:01:10.140
It has been pointed out that my Forth answer has a problem. It's too late to fix it, right? What do I do? It needs to be
KEY EMIT
, since I missed the printing part. I know it's supposed to be fixed w/in 30 min. But do I then change all the other answers? – mbomb007 – 2015-09-10T18:09:18.633Does the program have to exit after outputting, or can it hang (waiting on further user input)? – DLosc – 2015-09-10T23:08:12.437
@DLosc I think the general consensus on the site is that it's fine to hang. – Ypnypn – 2015-09-10T23:39:50.523
The leaderboard doesn't seem to be accurate unless I misunderstood the scoring. Specifically, it seems to just add up the scores instead of adding them and multiplying by number of submissions. Of course that just means Mauris' domination is much greater than stated. :) – ThaddeusB – 2015-09-11T01:11:29.650
@ThaddeusB I did not notice that part. Thanks for pointing it out! But, um, why do we need to multiply it? Isn't that essentially squaring it? I.e. 1 answer of 1 char is 30 points, while 4 answers of 1 is 1204=480 points, 20 answers of 1 is 60020=12000, etc. – ETHproductions – 2015-09-11T01:42:01.597
1@ETHproductions Two answers worth 10 each = 20 points x 2 = 40; 1 answer worth 20 points = 20 points. I assume the multiplier is to encourage multiple answers; even if some are not high-scoring, they can still have an impact. – ThaddeusB – 2015-09-11T01:51:59.580
@ThaddeusB I see what you mean, and I've added the multiplier to the leaderboard. But it still seems like a little much to me; this equation could be summed up as
average_score*(num_of_answers^2)
. As an alternative, we could add 20 (or some similar number) to each score. Ypnypn, what do you think about this? – ETHproductions – 2015-09-11T02:08:12.843Can you have comments in your answer? – LegionMammal978 – 2015-09-12T16:51:27.723
@LegionMammal978 Yes – Ypnypn – 2015-09-17T20:09:08.573
@ETHproductions (I just saw your comment) That's not a bad idea, but I think it's too late to change the scoring in such a big way. – Ypnypn – 2015-09-17T20:10:14.650
@Ypnypn For the moment, I've added in an experimental leaderboard using the modified formula. You can roll back the edit if you prefer. The only change in the top 14 is DLosc being moved up three positions (not sure why). – ETHproductions – 2015-09-17T20:19:16.300
Leaderboard doesn't seem to be working? – FlipTack – 2017-11-12T12:45:03.027