17
1
This is an answer-dependent challenge! The order of answers matters, and your exact task depends on the last answer that was posted. You might want to sort the answers by oldest.
Let's piece together some code! Here are 1920 random (printable ASCII) characters. Think of them as a big heap of unsorted jigsaw puzzle pieces still in the box:
L-^=v^Ej2tW8OxNOIecSt4m}tji2O%YRJ;PJ!M|0*oO77$*Rs&2*<c"KI7e%FY^?I=];Y@`x)u)IBk%_a#<E6<yv5O*$kL):
KNGq)2Wa%b)j."(6U|{[UY@`lrCSJ`u0RHX!1z7f,v}n=GvRgkrEZ=YT:4H44bz]iC<](:+FF?Ay'vX~h5QMF)0vaXk1sk@p
Zj).{+l;PBKHABvEP%FnSw>u<_-4B^A>I8Kay&5]vXZJ{fCF]UVZ<!ZpOI$7\Y%`@:%H3wPsX-`/l]ZZ?Q/d`\M<T@'t]zip
{[ovg:6EpCT&'+vU4Heb^;}0AV|?<}M0rAH/^DL"RkT~%$[VUlM]-&We4(P=66},hL~;a`:$'yty.W[g2OWcL~b:Ryj0*eN<
;&-n[F1F=oh0k[NI!xS"]pA@Y;K}'=ekG5yda8J$+`N;:FIx:l,f_LT@sV[]HF@2*vl?|q"GL1j&%e(CyYPqY%3W|@`z}]bp
4_'1Nx{"G2&j6$UWt_#%`sTt2xC}s1P8J<gV24_RWge/aMuyVOjz=zS!1i2s@`Q#@^~@W/k@.YLbKxS:g9?J^p;7ju?B\yC5
x,ZApKS5G4}kx_iM)f4/|su>=[{XSV#{,j5Qn3U.v5LF;HXs%DYm4'+efmU;\}f6j$SFCRC`Gsd37:'3$q=bs;lvsW0Yj^:-
I[94@I|.IpR=}4KB4Z0G4>8PR29'L?n\gk,*4X[-%T`\FC)jj0jl_x<xL8E:G2-"3tT8&E}"sE+SH[7jR%@V)a{!m8K>.rAO
2[dq7GX9nrz8p4}^2mn@q|dF%<.Tl8)Dk?O.<UoE(a*k_=4+u!h$^bVd:$jS#EHFh@Z=y=ib^~/~lEJ^SQ3E_t#&^IOov7v8
~j#I#OHgxg{DZDyCsq-(GVq}HbiG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s#G6A.s<OA_,TI_b*&lO@L3KrQv
The "floor" we're puzzling on is initially just a 96x20 grid of spaces (code point 0x20). Each answer may move around adjacent blocks of pieces, and choose up to 10 puzzle pieces (characters) and add them to the puzzle to create a new program. That program must print the number of your answer (numbered sequentially, starting from 1).
Answering
The key thing to understand about this challenge is that only one person can answer at a time and each answer depends on the one before it.
There should never be two answers with the same number N. If two people happen to simultaneously answer for some N, the one who answered later (even if it's a few seconds difference) should graciously delete their answer.
To make this run a bit smoother, try to stick to the following steps when posting your answer:
- Make sure that someone has independently verified the correctness of the previous answer (and left a corresponding comment).
Take the previous "puzzle floor" and "box of pieces". You may move any adjacent block of characters on the puzzle floor around freely as a unit (characters are adjacent if they touch along the horizontal or vertical direction). Adjacent blocks cannot be split up again. Examples on a 5x4 grid:
Last answer: Valid: Invalid: |a bc| |d g | |a bc| | bc | |a bc| | d e | |fa bc| |d e | -or- |d e | -or- | e | | f g| | e | | f g| |f g | |df g | | h | |h | | h | | h | | h |
In the valid example,
a
was moved one step down and right. Thedf
block was moved to the top left. Thebce
block was moved down by 1. Theg
was move two up and one to the left. Theh
block was moved all the way to the left.
In the first invalid exampledf
has been separated. In the second,a
has been removed. In the third,df
has been rotated.Next, remove at least 1 and up to 10 characters from the "box of pieces" and choose that many spaces on the "puzzle floor", which you'll replace by those characters. This is your submitted program. Please include both the new "puzzle floor" and "box of pieces" in your answer.
Post your answer in the following format:
# N. [Language], [number of blocks moved], [number of pieces added] [grid that is your program] ### Remaining pieces: [grid of remaining characters] [notes, explanation, observations, whatever]
where
N
is the number of your answer.This is absolutely vital to the challenge! I've provided a dashboard tool for the challenge to help with the bookkeeping, and it relies on the above template. (See bottom of the post.)
- Please include the vertical bars at the sides of puzzle floor, because otherwise, Stack Exchange won't display empty lines. These two columns are never to be considered part of the code.
- Another user should now review your submission and leave a comment "Correctness verified" if your answer follows all the rules (see below). If it doesn't, they should leave a comment pointing out any flaws. You've then got 15 minutes to fix those issues. If you don't, your answer will be deemed invalid, should be deleted, and someone else may post a follow-up answer to the previous one. (If this happens, you're free to submit a new answer any time.)
These regulations may seem rather strict, but they are necessary to avoid invalid answers somewhere up the chain.
The Rules
- A user may only submit one answer per 4 hour period. (This is to prevent users from constantly watching the question and answering as much as possible.)
- A user may not submit two answers in a row. (e.g. since I submitted answer 1 I can't do answer 2, but I could do 3.)
- No language may be used more than once! Different versions of the same language count as the same language. Languages count as distinct if they are traditionally called by two different names. (There may be some ambiguities here but don't let that ruin the contest.)
- Do not edit answers that have been verified.
Should a mistake be discovered earlier in the chain (i.e. after follow-up answers have been posted), the offending answer should be deleted. However, all answers that have been posted since should not be changed to reflect this.
Your program has to print
N
, the number of your answer, to STDOUT or closest alternative. It has to be a full program and must not assume a REPL environment.- You may or may not print a trailing newline.
Let M be the number of blocks you moved for your answer (no matter how far) and P the number of characters you added to the puzzle floor, the score of your answer will be 10 + N - M - P. As a 5x4 example, if your answer changed the puzzle floor as follows
|a bc| |a ij | | d e | --> | d bc| | f g| | f eg| | h | | h k|
your score would be 10 + N - 2 - 3 = N + 5, because two blocks were moved (
h
andbce
) and three characters were added (i
,j
andk
).The winner will be the user who accumulates the greatest number of points across their answers. In case of tie, the user with the latest answer wins. I will accept the winner's latest answer.
- In the unlikely event that all characters will be used up, the challenge ends.
Dashboard
Here is a little Dashboard tool, which should help with the necessary bookkeeping for this type of challenge.
It displays the current status of the challenge - in particular, if there are conflicting answers, if an answer needs to be verified, or if the next answer can be posted.
It also produces a list of all languages that have been used, as well as a leaderboard of all users. Please stick to the answer format above, so the dashboard can read out the relevant strings from your answers. Otherwise you might not be included in the leaderboard.
Please let me know (ideally in chat) if you spot any bugs or have some ideas how the usefulness of the tool could be improved.
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 commentsUrl(e,t){return"http://api.stackexchange.com/2.2/answers/"+e+"/comments?page="+t+"&pagesize=100&order=asc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){$.ajax({url:answersUrl(page++),method:"get",dataType:"jsonp",crossDomain:true,success:function(e){answers.push.apply(answers,e.items);if(e.has_more)getAnswers();else{page=1;getFinalComments()}}})}function getFinalComments(){answers=answers.filter(shouldHaveHeading);answers=answers.filter(shouldHaveScore);console.log(answers);$.ajax({url:commentsUrl(answers[0].answer_id,page++),method:"get",dataType:"jsonp",crossDomain:true,success:function(e){comments.push.apply(comments,e.items);if(e.has_more)getAnswers();else process()}})}function shouldHaveHeading(e){var t=false;try{t|=/^(#|<h).*/.test(e.body_markdown);t|=["-","="].indexOf(e.body_markdown.split("\n")[1][0])>-1}catch(n){}return t}function shouldHaveScore(e){var t=false;try{t|=HEADER_REG.test(e.body_markdown.split("\n")[0])}catch(n){}return t}function findDuplicates(e){var t=false;var n={};e.forEach(function(e){var r=e.body_markdown.split("\n")[0].match(NUMBER_REG)[0];if(n[r])t=t||r;n[r]=true});return t}function hasBeenVerified(e,t){var n=false;t.forEach(function(t){n|=/correctness verified/i.test(t.body_markdown)&&e!=t.owner.user_id});return n}function userTimedOut(e){return NOW-e.creation_date*1e3<MSEC_PER_ANSWER}function getAuthorName(e){return e.owner.display_name}function getAnswerScore(e,t,n){e=parseInt(e);t=parseInt(t);n=parseInt(n);return 10+e-t-n}function process(){$("#last-user").append(answers[0].owner.display_name);var e=answers.slice(1).filter(userTimedOut).map(getAuthorName).join(", ");if(e)$("#timed-out-users").append(e);else $("#timed-out-notice").hide();var t=answers[0].body_markdown.split("\n")[0].match(NUMBER_REG)[0];var n=findDuplicates(answers);if(n){var r=$("#status-conflict-template").html();$("#challenge-status").append(r.replace("{{NUMBER}}",n));$("#challenge-status").addClass("conflict")}else if(!hasBeenVerified(answers[0].owner.user_id,comments)){var r=$("#status-verification-template").html();$("#challenge-status").append(r.replace("{{NUMBER}}",t));$("#challenge-status").addClass("verification")}else{var r=$("#status-next-template").html();$("#challenge-status").append(r.replace("{{NUMBER}}",t).replace("{{NEXT}}",parseInt(t)+1));$("#challenge-status").addClass("next")}var i={};var s={};var o=[];answers.forEach(function(e){var t=e.body_markdown.split("\n")[0];var n=$("#answer-template").html();var r=t.match(HEADER_REG)||[0,-1,"",0,0];var u=r[1];var a=r[2];var f=r[3];var l=r[4];var c=getAnswerScore(u,f,l);var h=getAuthorName(e);n=n.replace("{{NAME}}",h).replace("{{NUMBER}}",u).replace("{{LANGUAGE}}",a).replace("{{MOVED}}",f).replace("{{ADDED}}",l).replace("{{SCORE}}",c).replace("{{LINK}}",e.share_link);n=$(n);$("#answers").append(n);i[h]=(i[h]||0)+c;s[h]=(s[h]||0)+1;o.push({lang:a,link:e.share_link})});var u=[];for(var a in i)if(i.hasOwnProperty(a)){u.push({name:a,numAnswers:s[a],score:i[a]})}u.sort(function(e,t){return t.score-e.score});var f=1;u.forEach(function(e){var t=$("#user-template").html();t=t.replace("{{NAME}}",e.name).replace("{{NUMBER}}",f++).replace("{{COUNT}}",e.numAnswers).replace("{{SCORE}}",e.score);t=$(t);$("#users").append(t)});o.sort(function(e,t){return e.lang.localeCompare(t.lang)});o.forEach(function(e){var t=$("#lang-template").html();t=t.replace("{{LANGUAGE}}",e.lang).replace("{{LINK}}",e.link);t=$(t);$("#lang-list").append(t)})}var QUESTION_ID=44966;var ANSWER_FILTER="!*cCFgu5yS6BFQP8Z)xIZ.qGoikO4jB.Ahv_g-";var COMMENT_FILTER="!)Q2B_A497Z2O1kEH(Of5MUPK";var HOURS_PER_ANSWER=4;var MSEC_PER_ANSWER=HOURS_PER_ANSWER*60*60*1e3;var NOW=Date.now();var answers=[],comments=[],page=1;getAnswers();var NUMBER_REG=/\d+/;var HEADER_REG=/(\d+)[.]\s*([^,]*[^,\s])\s*,[^,\d]*(\d+)[^,\d]*,[^,\d]*(\d+)/
body { text-align: left !important} #challenge-status { font-weight: bold; padding: 10px; width: 800px; } #blocked-users { padding: 10px; width: 800px; } .conflict { background: #994343; color: white; } .verification { background: #FFDB12; } .next { background: #75FF6E; } #last-user, #timed-out-users { font-weight: bold; } #answer-list { padding: 10px; width: 350px; float: left; } #leaderboard { padding: 10px; width: 280px; float: left; } #languages { padding: 10px; width: 130px; float: left; } table thead { font-weight: bold; } 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="challenge-status"> </div> <div id="blocked-users"> User <span id="last-user"></span> has posted the last answer, and may not post the next one. <div id="timed-out-notice"><span id="timed-out-users"></span> have answered within the last four hours and may not answer again yet. (If a user appears in this list twice, they must have answered twice within four hours!)</div> </div> <div id="answer-list"> <h2>List of Answers (newest first)</h2> <table class="answer-list"> <thead> <tr><td>No.</td><td>Author</td><td>Language</td><td>M</td><td>P</td><td>Score</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <div id="leaderboard"> <h2>Leaderboard</h2> <table class="leaderboard"> <thead> <tr><td>No.</td><td>User</td><td>Answers</td><td>Score</td></tr> </thead> <tbody id="users"> </tbody> </table> </div> <div id="languages"> <h2>Languages</h2> <table class="languages"> <tbody id="lang-list"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{NUMBER}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{MOVED}}</td><td>{{ADDED}}</td><td>{{SCORE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table> <table style="display: none"> <tbody id="user-template"> <tr><td>{{NUMBER}}</td><td>{{NAME}}</td><td>{{COUNT}}</td><td>{{SCORE}}</td></tr> </tbody> </table> <table style="display: none"> <tbody id="lang-template"> <tr><td><a href="{{LINK}}">{{LANGUAGE}}</a></td></tr> </tbody> </table> <div id="status-conflict-template" style="display: none"> There is more than one answer with number {{NUMBER}}!<br> Please resolve this conflict before posting any further answer. </div> <div id="status-verification-template" style="display: none"> Answer {{NUMBER}} has not been verified!<br> Please review the answer and post a comment reading "Correctness verified." on the answer if it is valid. Note that this has to be done by a different user than the author of the answer! </div> <div id="status-next-template" style="display: none"> Answer {{NUMBER}} has been verified!<br> You may now post answer {{NEXT}}. </div>
Useful scripts
Here are two CJam scripts for your convenience. You can run them in the online interpreter.
- To remove the first and last column from the puzzle floor (to get the actual code), paste it into STDIN, and run
qN/1f>Wf<N*
. - To pad your code out to a 96x20 rectangle and add the columns of vertical bars around it, run
qN/La20*+20<{96S*+96<'|\+'|+}%N*
on your code. To find out which characters were removed from the box of pieces between two answers, paste both of them into STDIN (without an empty line in between), and run
qS-N/20/{:+}%94,\f{\33+c_@\f/:,~-_0<{N"Added character: "@;@N}{*}?}
It will also show if characters were added (not how many though).
If someone wants to reimplement these as Stack Snippets, I'm happy to add them to this post.
Sort by oldest is useful here. – Sp3000 – 2015-01-26T11:29:17.223
So, we must stop our language from processing other characters (make them comments for example), and add code to send an integer to stdout using 10 new characters? I don't think Python will do well here. The 2 dimensional and golf languages should be interesting. – Logic Knight – 2015-01-26T11:54:21.147
@CarpetPython Yes, the entire "puzzle floor" has to be run as your code, so you may have to comment out existing code. That shouldn't be too hard right now though, since you could just collect all the unwanted blocks into one line, prepend and prepend a single-line comment. By the time this gets annoying, I'm sure we'll have run out of non-esoteric languages anyway. ;) – Martin Ender – 2015-01-26T11:55:45.973