34
\$\begingroup\$

In traditional Tetris, there are 7 distinct tetromino bricks, each denoted by a letter similar to its shape.

#          
#      #    #
#  ##  #    #  ###  ##    ##
#  ##  ##  ##   #    ##  ##
I  O   L   J    T    Z    S

Consider the arrangements of these bricks that can make a solid W×H rectangle, for some positive integers W and H. For example, using 2 I's, 1 L, 1 J, 2 T's, and 1 S, a 7×4 rectangle can be made:

IIIITTT
LIIIITJ
LTTTSSJ
LLTSSJJ

The same bricks can be rearranged (by moving and rotating but not flipping) into a different 7×4 pattern:

IJJTLLI
IJTTTLI
IJSSTLI
ISSTTTI

Now consider using a rectangular block of code in place of the first arrangement. For example this 7×4 bit of Python 3, which prints Tetris to stdout:

p=print
x='Tet'
y='ris'
p(x+y)#

According to the first Tetris arrangement its 7 "bricks" are...

           x          '
      int  y          '  ='r   is
p=pr   t   p(  ='Te  )#   x   +y

In the other arrangement (one of many possible) they are unintelligible as code:

r#)x(x=
p'r'=y'
='istpT
p+ytnie

But, given the bricks separately, it might be possible to piece them back together properly. This is the basis of the challenge.

Challenge

This is a challenge. There are two competing roles, the Jumblers and the Rebuilders.

The Jumblers submit answers with blocks of code that have been broken down into Tetris bricks.

The Rebuilders attempt to rebuild these blocks in the separate question dedicated for them: Jumblers vs Rebuilders: Coding with Tetris Bricks - Area for Rebuilder Answers.

Jumblers

Using only printable ASCII (hex codes 20 to 7E) write a W×H rectangular program. When run, it must output the sole word Tetris to stdout (or closest alternative). Do not post this code in your answer; don't give W or H either. Break it up into some arrangement of Tetris bricks like the example above and post these in your answer. (Your code may contain spaces but since they are hard to distinguish, it's best to use some other character in place of spaces and tell people what you used.)

The harder it is to rebuild your program the better. There may be many ways to rearrange your code-bricks into a rectangle, possibly with different dimensions. What the code does when run in these different arrangements doesn't matter as long as at least one arrangement prints Tetris to stdout.

The only other restriction is that W * H be less than 1025.

Jumblers should specify their programming language (and version).

Rebuilders

Your goal is to take a Jumbler's code-bricks and put them back into their original order, so Tetris is printed when the code is run. If the working arrangement you find isn't the one the Jumbler had in mind that's too bad for them.

Remember that only translation and rotation are allowed in rearrangements, not mirroring.

Scoring

Each time a submission is rebuilt it is considered "cracked" and is no longer in the running. The first Rebuilder to rebuild a submission gets the credit for it. If an answer goes uncracked for 72 hours the Jumbler should reveal the solution and will be henceforth immune from being cracked. A Jumbler must do this to win, since otherwise it will be unclear if there even was a solution.

The winning Jumbler is the uncracked answer with the smallest area (W * H = 4 * num of bricks). In case of ties the highest voted answer wins. The accepted answer for this question will be the winning Jumbler.

The winning Rebuilder is the user who cracks the most submissions. In case of ties it goes to whomever cracked the most cumulative area.

Notes

  • You may not rebuild your own submissions. (But otherwise you may take on both roles.)
  • Rebuilders may not attempt to crack the same answer more than once.

Scoreboard

Sorted from oldest submission to newest.

+--------------+-------------+------------------+---------+----------+----------------+-------------------------------------------+-------------------------------------------+
|   Jumbler    |  Language   |       Area       | Immune? | Rebuilt? |   Rebuilder    |                      Link                 |                  Solution Link            |
+--------------+-------------+------------------+---------+----------+----------------+-------------------------------------------+-------------------------------------------+
| xnor         | Python 3    | 212              | no      | yes      | foobar         | https://codegolf.stackexchange.com/a/40142 | https://codegolf.stackexchange.com/a/40203 |
| xnor         | Python 3    | 340              | no      | yes      | feersum        | https://codegolf.stackexchange.com/a/40146 | https://codegolf.stackexchange.com/a/40189 |
| es1024       | C           | 80               | no      | yes      | user23013      | https://codegolf.stackexchange.com/a/40155 | https://codegolf.stackexchange.com/a/40210 |
| Ethiraric    | Brainfuck   | 108              | yes     |          |                | https://codegolf.stackexchange.com/a/40156 |                                           |
| Qwertiy      | JavaScript  | 420              | yes     |          |                | https://codegolf.stackexchange.com/a/40161 |                                           |
| user23013    | Befunge     | 360              | yes     |          |                | https://codegolf.stackexchange.com/a/40163 |                                           |
| user23013    | CJam        | 80               | yes     |          |                | https://codegolf.stackexchange.com/a/40171 |                                           |
| Geobits      | Java        | 360              | yes     |          |                | https://codegolf.stackexchange.com/a/40180 |                                           |
| Dennis       | CJam        | 60               | yes     |          |                | https://codegolf.stackexchange.com/a/40184 |                                           |
| xnor         | Python 3    | 160              | yes     |          |                | https://codegolf.stackexchange.com/a/40192 |                                           |
| COTO         | C           | 72               | yes     |          |                | https://codegolf.stackexchange.com/a/40198 |                                           |
| es1024       | C           | 780              | yes     |          |                | https://codegolf.stackexchange.com/a/40202 |                                           |
| Gerli        | Mathematica | 72               | no      | yes      | Martin Büttner | https://codegolf.stackexchange.com/a/40230 | https://codegolf.stackexchange.com/a/40242 |
| Hydrothermal | JavaScript  | 80               | yes     |          |                | https://codegolf.stackexchange.com/a/40235 |                                           |
| Sam Yonnou   | GolfScript  | 48 (frontrunner) | yes     |          |                | https://codegolf.stackexchange.com/a/40239 |                                           |
| feersum      | Matlab      | 48               |         |          |                | https://codegolf.stackexchange.com/a/40310 |                                           |
| Beta Decay   | Python 3    | 484              |         |          |                | https://codegolf.stackexchange.com/a/40312 |                                           |
| potato       | Python 3    | 176              |         |          |                | https://codegolf.stackexchange.com/a/40341 |                                           |
+--------------+-------------+------------------+---------+----------+----------------+-------------------------------------------+-------------------------------------------+

(Thanks to http://www.sensefulsolutions.com/2010/10/format-text-as-table.html for table formatting.)

User COTO made an excellent tool for playing with code-bricks. I've turned it into a convenient snippet:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><script>function parseSpec(s){function first(){var e,t;t=S.findIndex(function(t){return(e=t.findIndex(function(e){return/\S/.test(e)}))!=-1});return t==-1?null:[e,t]}function at(e){var t=e[0],n=e[1];return n>=0&&n<S.length&&t>=0&&t<S[n].length?S[n][t]:" "}function wipe(e){var t=e[0],n=e[1];if(n>=0&&n<S.length&&t>=0&&t<S[n].length)S[n][t]=" "}var P,S=s.split("\n").map(function(e){return e.split("")});var oPats=$(".proto-tet [pat]").get().map(function(e){return{sPat:eval("["+$(e).attr("pat")+"]"),e:e,block:function(e){return[at(e)].concat(this.sPat.map(function(t){return at([e[0]+t[0],e[1]+t[1]])}))},wipe:function(e){this.sPat.forEach(function(e){return wipe([P[0]+e[0],P[1]+e[1]])})},match:function(e){return!/\s/.test(this.block(e).join(""))}}});window.oPats=oPats;while(P=first()){var oPat=oPats.find(function(e){return e.match(P)});if(!oPat){orphan(at(P));wipe(P);continue}createPiece(oPat.e,oPat.block(P));wipe(P);oPat.wipe(P)}}function createPiece(e,t){function r(e){var t=$(this).position();G.isIgnoreClick=false;G.eDrag=this;G.iOffsets=[e.clientX-t.left,e.clientY-t.top]}function i(){if(G.isIgnoreClick)return;var e=$(this);s($(".proto-tet ."+e.attr("rr")),function(e,t){return n[t-1]},e.css("left"),e.css("top"));e.remove()}function s(e,t,n,s){e.clone().html(e.html().replace(/@(\d)(\d)/g,t)).appendTo("body").on("mousedown",r).click(i).css({left:n,top:s})}var n=[];s($(e),function(e,r,i){return n[r-1]=t[i-1]},18+G.iSpawn%8*18*4+"px",18+~~(G.iSpawn/8)*18*4+"px");G.iSpawn++}function init(){$(document).on("mouseup",function(){return G.eDrag=null}).on("mousemove",function(e){if(G.eDrag){var t=$(G.eDrag),n=Math.round((e.clientX-G.iOffsets[0])/18)*18,r=Math.round((e.clientY-G.iOffsets[1])/18)*18,i=t.position();if(n!=i.left||r!=i.top)G.isIgnoreClick=true;t.css({left:n+"px",top:r+"px"})}})}function orphan(e){error("Spec character not a part of any block: '"+e+"'")}function error(e){$(".error").css("display","block").append("<div>"+e+"</div>")}function go(){$(init);$(function(){parseSpec($("#spec").val())});$("#spec").remove();$("#info").remove();$("#go").remove()}var G={eDrag:null,isIgnoreClick:true,iSpawn:0};Array.prototype.findIndex=function(e){for(var t=0;t<this.length;t++){if(e(this[t]))return t}return-1};Array.prototype.find=function(e){var t=this.findIndex(e);if(t==-1)return;else return this[t]}</script><style>.proto-tet, .spec{display: none;}.tet-I{color: darkgreen;}.tet-J{color: orangered;}.tet-L{color: navy;}.tet-T{color: darkred;}.tet-O{color: darkcyan;}.tet-S{color: darkviolet;}.tet-Z{color: darkorange;}body > .tet{position: absolute;cursor: move;-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;border-collapse: collapse;}.tet td{width: 18px;height: 18px;font: bold 14px "Courier New",monospace;text-align: center;vertical-align: middle;padding: 0;}.error{z-index: 1024;position: absolute;display: none;color: red;font-weight: bold;background-color: white;}textarea{font-family: "Courier New", Courier, monospace;}</style><div id='info'>Put code-bricks here and hit OK. Re-run the snippet to restart.<br>(You may need to replace spaces in code-bricks with some other character first.)</div><textarea id='spec' rows='16' cols='80'>ABCD&nbsp;&nbsp;a&#13;&#10;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;b&nbsp;&nbsp;&nbsp;Oo&#13;&#10;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c&nbsp;&nbsp;&nbsp;oo&#13;&#10;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d&#13;&#10;&#13;&#10;&nbsp;E&nbsp;&nbsp;&nbsp;&nbsp;h&#13;&#10;&nbsp;F&nbsp;&nbsp;efg&nbsp;&nbsp;&nbsp;hg&nbsp;&nbsp;&nbsp;GFE&#13;&#10;&nbsp;GH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;f&nbsp;&nbsp;&nbsp;H&#13;&#10;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e&#13;&#10;&#13;&#10;&nbsp;I&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IJK&#13;&#10;&nbsp;J&nbsp;&nbsp;&nbsp;l&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L&#13;&#10;LK&nbsp;&nbsp;&nbsp;kji&nbsp;&nbsp;kl&#13;&#10;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j&#13;&#10;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i&#13;&#10;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t&#13;&#10;&nbsp;OP&nbsp;&nbsp;&nbsp;p&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QR&nbsp;&nbsp;&nbsp;&nbsp;rs&#13;&#10;MN&nbsp;&nbsp;&nbsp;&nbsp;on&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ST&nbsp;&nbsp;&nbsp;q&#13;&#10;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m&#13;&#10;&nbsp;W&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z&#13;&#10;&nbsp;XY&nbsp;&nbsp;&nbsp;&nbsp;zxw&nbsp;&nbsp;&nbsp;&nbsp;yx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Y&#13;&#10;&nbsp;Z&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;w&nbsp;&nbsp;&nbsp;&nbsp;WXZ</textarea><br><button id='go' type='button' onclick='go()'>OK</button><div class="proto-tet"><table class="tet tet-I tet-I0" rr="tet-I1" pat="[1,0],[2,0],[3,0]"><tr><td>@11</td><td>@22</td><td>@33</td><td>@44</td></tr></table><table class="tet tet-I tet-I1" rr="tet-I2" pat="[0,1],[0,2],[0,3]"><tr><td>@11</td></tr><tr><td>@22</td></tr><tr><td>@33</td></tr><tr><td>@44</td></tr></table><table class="tet tet-I tet-I2" rr="tet-I3" ><tr><td>@40</td><td>@30</td><td>@20</td><td>@10</td></tr></table><table class="tet tet-I tet-I3" rr="tet-I0"><tr><td>@40</td></tr><tr><td>@30</td></tr><tr><td>@20</td></tr><tr><td>@10</td></tr></table><table class="tet tet-J tet-J0" rr="tet-J1" pat="[0,1],[-1,2],[0,2]"><tr><td></td><td>@11</td></tr><tr><td></td><td>@22</td></tr><tr><td>@33</td><td>@44</td></tr></table><table class="tet tet-J tet-J1" rr="tet-J2" pat="[0,1],[1,1],[2,1]"><tr><td>@31</td><td></td><td></td></tr><tr><td>@42</td><td>@23</td><td>@14</td></tr></table><table class="tet tet-J tet-J2" rr="tet-J3" pat="[1,0],[0,1],[0,2]"><tr><td>@41</td><td>@32</td></tr><tr><td>@23</td><td></td></tr><tr><td>@14</td><td></td></tr></table><table class="tet tet-J tet-J3" rr="tet-J0" pat="[1,0],[2,0],[2,1]"><tr><td>@11</td><td>@22</td><td>@43</td></tr><tr><td></td><td></td><td>@34</td></tr></table><table class="tet tet-O tet-O0" rr="tet-O1" pat="[1,0],[0,1],[1,1]"><tr><td>@11</td><td>@22</td></tr><tr><td>@33</td><td>@44</td></tr></table><table class="tet tet-O tet-O1" rr="tet-O2"><tr><td>@30</td><td>@10</td></tr><tr><td>@40</td><td>@20</td></tr></table><table class="tet tet-O tet-O2" rr="tet-O3"><tr><td>@40</td><td>@30</td></tr><tr><td>@20</td><td>@10</td></tr></table><table class="tet tet-O tet-O3" rr="tet-O0"><tr><td>@20</td><td>@40</td></tr><tr><td>@10</td><td>@30</td></tr></table><table class="tet tet-L tet-L0" rr="tet-L1" pat="[0,1],[0,2],[1,2]"><tr><td>@11</td><td></td></tr><tr><td>@22</td><td></td></tr><tr><td>@33</td><td>@44</td></tr></table><table class="tet tet-L tet-L1" rr="tet-L2" pat="[1,0],[2,0],[0,1]"><tr><td>@31</td><td>@22</td><td>@13</td></tr><tr><td>@44</td><td></td><td></td></tr></table><table class="tet tet-L tet-L2" rr="tet-L3" pat="[1,0],[1,1],[1,2]"><tr><td>@41</td><td>@32</td></tr><tr><td></td><td>@23</td></tr><tr><td></td><td>@14</td></tr></table><table class="tet tet-L tet-L3" rr="tet-L0" pat="[-2,1],[-1,1],[0,1]"><tr><td></td><td></td><td>@41</td></tr><tr><td>@12</td><td>@23</td><td>@34</td></tr></table><table class="tet tet-S tet-S0" rr="tet-S1" pat="[1,0],[-1,1],[0,1]"><tr><td></td><td>@21</td><td>@12</td></tr><tr><td>@43</td><td>@34</td><td></td></tr></table><table class="tet tet-S tet-S1" rr="tet-S2" pat="[0,1],[1,1],[1,2]"><tr><td>@41</td><td></td></tr><tr><td>@32</td><td>@23</td></tr><tr><td></td><td>@14</td></tr></table><table class="tet tet-S tet-S2" rr="tet-S3"><tr><td></td><td>@30</td><td>@40</td></tr><tr><td>@10</td><td>@20</td><td></td></tr></table><table class="tet tet-S tet-S3" rr="tet-S0"><tr><td>@10</td><td></td></tr><tr><td>@20</td><td>@30</td></tr><tr><td></td><td>@40</td></tr></table><table class="tet tet-Z tet-Z0" rr="tet-Z1" pat="[1,0],[1,1],[2,1]"><tr><td>@11</td><td>@22</td><td></td></tr><tr><td></td><td>@33</td><td>@44</td></tr></table><table class="tet tet-Z tet-Z1" rr="tet-Z2" pat="[-1,1],[0,1],[-1,2]"><tr><td></td><td>@11</td></tr><tr><td>@32</td><td>@23</td></tr><tr><td>@44</td><td></td></tr></table><table class="tet tet-Z tet-Z2" rr="tet-Z3"><tr><td>@40</td><td>@30</td><td></td></tr><tr><td></td><td>@20</td><td>@10</td></tr></table><table class="tet tet-Z tet-Z3" rr="tet-Z0"><tr><td></td><td>@40</td></tr><tr><td>@20</td><td>@30</td></tr><tr><td>@10</td><td></td></tr></table><table class="tet tet-T tet-T0" rr="tet-T1" pat="[1,0],[2,0],[1,1]"><tr><td>@11</td><td>@22</td><td>@33</td></tr><tr><td></td><td>@44</td><td></td></tr></table><table class="tet tet-T tet-T1" rr="tet-T2" pat="[-1,1],[0,1],[0,2]"><tr><td></td><td>@11</td></tr><tr><td>@42</td><td>@23</td></tr><tr><td></td><td>@34</td></tr></table><table class="tet tet-T tet-T2" rr="tet-T3" pat="[-1,1],[0,1],[1,1]"><tr><td></td><td>@41</td><td></td></tr><tr><td>@32</td><td>@23</td><td>@14</td></tr></table><table class="tet tet-T tet-T3" rr="tet-T0" pat="[0,1],[1,1],[0,2]"><tr><td>@31</td><td></td></tr><tr><td>@22</td><td>@43</td></tr><tr><td>@14</td><td></td></tr></table></div><div class="error"></div>

\$\endgroup\$
  • 10
    \$\begingroup\$ Sounds like a job for Befunge. \$\endgroup\$ – Martin Ender Oct 22 '14 at 10:03
  • 8
    \$\begingroup\$ Would OP please tell us how he manages to come up with stuff like this? \$\endgroup\$ – Soham Chowdhury Oct 23 '14 at 12:59
  • 5
    \$\begingroup\$ @SohamChowdhury I can't say much more than I've already said. My main tenets are simplicity and originality. \$\endgroup\$ – Calvin's Hobbies Oct 23 '14 at 19:51
  • \$\begingroup\$ Can I still submit a problem, or is this challenge closed to Jumblers? \$\endgroup\$ – ASCIIThenANSI May 17 '15 at 18:40
  • \$\begingroup\$ @ASCIIThenANSI Go ahead. Not many rebuilders are still around though. \$\endgroup\$ – Calvin's Hobbies May 17 '15 at 18:43

18 Answers 18

3
\$\begingroup\$

GolfScript 48

I pieces:

!;..  )+?;

O pieces:

.[  ;*  .(
):  ++  -\

T pieces:

+]\  +++  ;).  );.
 .    *    ,    )

J pieces:

.    )    *
(@@  :?,  .,:

Solution

.[!)):,.
):;+:?,*
;*.?;).+
++.;),*+
.(..;).+
-\(@@\]+

\$\endgroup\$
  • \$\begingroup\$ Yeah oops I was using it to come up with the tetris pieces. I edited it quickly enough that the "edited" link shouldn't show up so people shouldn't be able to look at the edit history for the answer. \$\endgroup\$ – SamYonnou Oct 23 '14 at 19:16
  • \$\begingroup\$ Well I don't want to spoil the game, but let's hope I was the only one who opened the page that quickly. ;) \$\endgroup\$ – Martin Ender Oct 23 '14 at 19:19
  • \$\begingroup\$ I know this is long overdue but I'm officially ending the contest, and unless I'm mistaken this submission won! Sam, I'll accept this answer if you post the solution to prove that it was in fact possible. \$\endgroup\$ – Calvin's Hobbies Jan 4 '15 at 7:26
  • \$\begingroup\$ @Calvin'sHobbies Done \$\endgroup\$ – SamYonnou Jan 5 '15 at 13:31
23
\$\begingroup\$

Java : 360 area

Bounty: 500

Reconstructing these things is hard! That's probably why there aren't too many robbers participating in this challenge. However, I want to see mine cracked. So, instead of giving the solution after 72 hours, I'm putting up 500 rep to the first successful cracker. To clarify, I will add a +500 bounty to the answer post and award it to your crack if you reassemble these pieces into any working, rectangular Java program that outputs "Tetris". I am not preemptively activating the bounty, because I don't feel like wasting rep if nobody answers.

There is no end date to this offer. It's valid as long as I'm a member here. To ensure I see your answer, ping me with a comment below.

I've triple-checked to make sure the pieces (and code) are valid, but if a trusted user wants to confirm this, I can email/something the solution to them. Obviously, that would exempt them from posting it and collecting the bounty.

Made of a mix of all seven piece types. To make things easier(?) I've made sure that all pieces of the same type are rotated to the same orientation. Since Java has parts that can't be changed much, I've left the really obvious parts as simple I-blocks to get it started.

Note: Since Java has a few mandatory spaces, I've replaced them with underscores (_)below for layout purposes. There are 11 of them total, and they should all be converted to spaces to run the code. No other whitespace is present in the code, any below is just for positioning.

There are:

  • 41 I
  • 15 O
  • 11 J
  • 8 L
  • 6 T
  • 6 S
  • 3 Z

Have fun!

------------- I 

clas    s_X{    publ    ic_s

tati    c_vo    id_m    ain(    

Stri    ng[]    2;c*    p(b-    

(b-c    _voi    nt_a    Syst    

em.o    ut.p    rint    1,c=    

d=1,    e=3,    new_    int[    

;b++    for(    1008    ?1:2    

)a);    ccc+    ==++    pf}(    

for(    (b);    p(b+    --b-    

or(d    1?1:    +1;e    for(    

=1);

------------- O

a)
*2

b=
r(

12
<3

36
[c

*1
++

b<
6]

64
64

7]
]-

<1
1;

89
0;

;p
c)

=0
ic

st
ch

at
ar

d/
1;

-------------- T

{in
 ]

+b(
 5

d/2
 ;

d<<
 )

;;;
 1

=1)
 (

------------- L

2=[
+

]b*
8

=1)
]

<<b
<

}_}
d

3=b
)

+[[
=

=c,
=

-------------- J

o
;b=

,
2;)

f
2;c

*
=][

c
f=d

+
e1+

e
=;;

d
_p(

i
<++

=
){_

[
f+e

---------------- S

 t_
;f

 c+
1)

 +<
;p

 64
<6

 b=
;p

 ))
(;

--------------- Z

4,
 -1

;=
 ff

;f
 0;
\$\endgroup\$
  • \$\begingroup\$ Do any of the code blocks have to be rotated to construct a valid (or at least, the intended) solution? \$\endgroup\$ – El'endia Starman Sep 25 '15 at 6:42
  • \$\begingroup\$ @El'endiaStarman Yes, you'll need to rotate some for the intended solution. \$\endgroup\$ – Geobits Sep 25 '15 at 12:52
12
\$\begingroup\$

Brainfuck, 108 area

This code was made of 27 I pieces.

-.[>
.<++
.<++
[>++
[>++
-]++
]>.-
-]>[
-]>+
]>++
+.+-
+[>+
+-+-
++[>
++[>
++]-
++++
++++
+++<
+++<
+<-]
--<-
<-]>
<><+
>+.>
>++[
>+<<

I don't know if there is any way other than bruteforce to find the answer. If there is, i'd really like to know how.

\$\endgroup\$
9
\$\begingroup\$

Python 3: 212 area [Rebuilt]

My code is broken up into the following 53 I-pieces, which I've written one per line alphabetically.

(358
0048
0396
0796
0824
0981
1013
1314
1330
1438
1502
2285
2317
2479
2585
2955
3116
3738
3818
4169
4356
4360
4632
4800
5016
5153
5256
5394
5598
5631
5758
5840
6312
6425
6539
7045
7156
7163
7329
7624
7674
8164
8250
8903
9%38
9009
94))
9413
9748
etri
prin
s'* 
t('T

Have fun!

\$\endgroup\$
  • \$\begingroup\$ I found a vulnerability in this method, but I'll leave it to be cracked. I've posted another answer that I hope is more secure. \$\endgroup\$ – xnor Oct 22 '14 at 6:00
  • 8
    \$\begingroup\$ print('Tetris'* (3580048039607960824098110131314133014381502228523172479258529553116373838184169435643604632480050165153525653945598563157585840631264256539704571638903974876749009825073297156762481649%38941394)) \$\endgroup\$ – foobar Oct 22 '14 at 7:22
  • 1
    \$\begingroup\$ @foobar Congrats! Did you try lots of shuffles mod 38941394 or something more systematic? How long did it take? Also, why not %3894? \$\endgroup\$ – xnor Oct 22 '14 at 7:29
  • 1
    \$\begingroup\$ I just pre-built print('Tetris'* (358UNKNOWN94)) and as I was pretty sure that you didn't rotate any tiles, all I did was to build all possible permutations of the remaining tiles, joined them together and evaluated if 358UNKNOWN94 is equal to 1, while i replaced UNKNOWN with the permutation. So I didn't use %3894 because a different matching permutation was found first ;) I don't know how long it took exactly, but it was about 20 minutes using a single core. So I actually used something less systematic, I just bruteforced the solution ;) \$\endgroup\$ – foobar Oct 22 '14 at 7:36
  • 1
    \$\begingroup\$ @MartinBüttner done ;) codegolf.stackexchange.com/a/40203/19475 \$\endgroup\$ – foobar Oct 23 '14 at 8:01
5
\$\begingroup\$

JavaScript - Area 80

Seems like a lot of these answers are just using lots of I pieces and maybe an O piece or two, so I threw this together with some of the more interesting shapes.

  • 7 I pieces
  • 1 L piece
  • 1 J piece
  • 4 O pieces
  • 6 T pieces
  • 1 S piece

Each piece is separated by two spaces. The two hash signs are actually spaces in the code.

l  n  \  /  ;  +  r
o  -  x  c  v  (  i
g  (  5  o  a  ;  s    )  o    //  #c  ns  ->   )    "    d    l    e    l    wi
(  "  4  n  r  ;  "  x65  log  ;/  ")  ].  "c  "(#  o+\  ave  ow"  t"o  "Te  [" 

Have fun!

\$\endgroup\$
5
\$\begingroup\$

Javascript, area 420

Only I-blocks.

!!!(
!!!+
!!!+
!!![
!!!]
!!!]
!!!]
!!!]
!!!]
!!'!
!![]
!!]]
!(!+
!(![
!+!]
!+!]
!+"+
!++)
!++[
!++[
!++[
!++[
!++]
![+[
!](+
(!!'
(!!+
(!(]
(++!
(['[
)!'!
)[)[
)]]!
+++"
+++)
++++
+++[
+++]
++])
+[+[
+[[[
+]'+
+]']
+]+[
+]+[
+]]!
+]]!
+]]!
+]]!
+]]'
+]][
+]]]
[!!+
[!!+
[!!+
[!!+
[!!+
[!!]
[!+!
[![[
[![[
[((!
[))!
[){!
[+'+
[++)
[++]
[[)+
[[+[
[[[!
[[['
[[[+
[][]
[]]]
[{[[
]!(!
]!]+
]['[
][[!
][[!
][[!
][[!
][[(
][[+
][[+
][[[
][[[
][]]
][}!
]]T]
]][(
]]]!
]]]!
]]]'
]]])
]]]]
]}]]
a['!
e]'(
l++[
v).!
{[[[
{]g]
})')
}]]]

No any standard obfuscators were used. All code including obfuscation and making this sorted list of blocks is made by less then 16 lines of my own code.


It's time to show how it was made:

x="+[],+!![],+!![]+!![],+!![]+!![]+!![],+!![]+!![]+!![]+!![],+!![]+!![]+!![]+!![]+!![],+!![]+!![]+!![]+!![]+!![]+!![],+!![]+!![]+!![]+!![]+!![]+!![]+!![],+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![],+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]".split(/,/g)
res={}
for(q=0; q<x.length; ++q) res[eval(x[q])]=x[q]
function add(str) { for(q=0;q<Math.min(str.length,10);++q) res[eval(x=str+"["+res[q]+"]")]=x }
add("({}+[])")
add("(![]+[])")
add("(!![]+[])")
add("([][[]]+[])")
code = 'eval('+Array.prototype.map.call('console.log("Tetris")',function(x){return res[x]||"'"+x+"'"}).join("+")+')'
res=[]
console.log(code)
code.replace(/(.)(?=.{104}(.).{104}(.).{104}(.))/g,function(m,a,b,c,d){res.push(a+b+c+d)})
eval(res.map(function(x){return x[0]}).join("")+res.map(function(x){return x[1]}).join("")+res.map(function(x){return x[2]}).join("")+res.map(function(x){return x[3]}).join(""))
console.log(res.sort().join("\n"))

So, it's just call to eval with obfuscated 'console.log("Tetris")' argument, which is 420 symbols in length. It is splitted into 4 lines of 105 symbols and read by columns and alphabetical sorted.

Obfuscation for 10 digits is hardcoded, for other symbols used first 10 symbols from 4 combinations passed to add function. If there is no obfuscation for some symbol it is passed as is.

\$\endgroup\$
  • \$\begingroup\$ Is it time to post how it was done? \$\endgroup\$ – Qwertiy Oct 25 '14 at 23:21
  • \$\begingroup\$ @Qwerity Yes, if you want. \$\endgroup\$ – Calvin's Hobbies Oct 26 '14 at 23:59
  • \$\begingroup\$ Explanation is added. \$\endgroup\$ – Qwertiy Oct 27 '14 at 7:59
4
\$\begingroup\$

C, 80 area

Made of 12 I pieces and 8 O pieces. C syntax is always fun.

I pieces in no particular order:

 c[] // starts with a space
','n
',;}
(q){
,',  // ends in a space 
u>6/
T2sr
char
main
q/**
t#1'
ts(c

O pieces:

q<
pu

't
i'

Ir
$'

/}
);

'?
re

',
`:

"e
i>

={
,0
\$\endgroup\$
  • 2
    \$\begingroup\$ main(q){char c[] ={'/T','$"e','t' ,0162,'rIi>`:i', '?#>s',q<q/**/}; return puts(c);} \$\endgroup\$ – jimmy23013 Oct 22 '14 at 14:56
  • \$\begingroup\$ @user23013 Congratulations! \$\endgroup\$ – es1024 Oct 22 '14 at 22:55
4
\$\begingroup\$

CJam, 60 (15 O's)

71 05 37 23 36 04 27 69 32 :i 12 93 bi i] 43
69 44 71 71 -# 70 10 25 44 cb 93 20 *G 9B 62

Solution

27
10
96
17
54
04
52
96
71
37
12
93
43
62
29
03
07
40
44
23
72
13
]B
i9
*b
Gi
6#
3-
ib
:c

\$\endgroup\$
4
\$\begingroup\$

Befunge, 360 area

90 O-pieces.

 "
#6

 "
#^

 #
# 

 #
4 

 +
$ 

 +
0>

 +
v_

 0
> 

 3
# 

 >
\ 

 ^
/1

 _
v8

 v
$,

 ~
*=

!!
00

!<
v>

"!
< 

"<
#^

">
^<

"v
# 

"v
w\

# 
 #

# 
|_

#*
_*

#0
.@

#3
~#

#?
t@

#^
RI

#v
~>

#~
~#

$ 
!4

&v
v#

*#
"#

**
>^

+1
>^

+5
 ,

+^
S"

- 
#"

-#
2\

-~
 #

0 
|>

00
00

0<
v\

2,
+#

2v
^v

3#
< 

3#
>2

3~
^-

47
31

6 
6#

70
"T

8#
:\

:#
 #

:$
$*

:0
3<

< 
#$

<*
<|

<<
>>

<>
<>

<@
 >

<~
2,

> 
7<

>$
^6

>>
<<

>v
|g

\ 
^ 

\_
 !

^ 
<s

_!
>9

_$
ET

kr
 >

m~
#3

q~
~+

r^
c 

t~
, 

v 
 ?

v/
_$

v4
>>

v7
>#

v<
>#

v<
>#

v>
:^

v~
1/

zr
 $

~#
#~

~#
\#

~$
7>

~3
$_

~v
\$

~~
~#

You can try it here.

3#~#~vm~00-~q~\_:$:#r^&v_!!<v<
>2\#\$#300 #~+ !$* #c v#>9v>>#
"v0< 36 v < ~~ ^<~^ <<<@\ -##v
w\v\# 6# ?#$~#/12,<s>> >^ 2\~>
"> +>$ +:0 _ #2,v/$ >>v4v7- 3~
^<0>^6v_3<v84 +#_$!4<<>>>##"^-
<*8#> #0 v ~v~2v#~~#kr"v "zr"<
<|:\7<.@$,*=1/^v~##~ ># #6 $#^
#*+1# 3# 0470 >vv< ## ~$t~ "<>
_*>^|_< > 31|>|g>##  #7>, #^<>
70_$#^+^~3 +** >v>!!+5#3*#"!#?
"TETRIS"$_$ >^\ :^00 ,~#"#< t@

There are probably other solutions. I didn't rotate the bricks.

\$\endgroup\$
  • \$\begingroup\$ This is one of the most convoluted Befunge programs I have ever seen and watched run. Very clever! \$\endgroup\$ – El'endia Starman Sep 25 '15 at 1:57
3
\$\begingroup\$

Python 3: 340 area [Rebuilt]

Made of 85 I-pieces, given here alphabetized one per line.

    #Four spaces
    #Four spaces
    #Four spaces
    #Four spaces
    #Four spaces
    #Four spaces
    #Four spaces
    #Four spaces
    #Four spaces        
))  #Two spaces
0290
0398
0866
0887
0892
0992
1108
1268
1297
1339
1555
1722
1817
1848
1930
2328
2521
2611
2747
3179
3192
3245
3284
3334
3613
3862
4086
4629
4639
4674
4695
4781
4968
5723
5742
5791
5938
6011
6069
6180
6231
6265
6269
6444
6564
6776
6884
7116
7253
7348
7440
7527
7743
7873
8064
8291
8808
8843
9305
9324
9458
9460
9586
9869
====
a,b,
abcd
c)-d
etri
pow(
prin
s'*(
t('T

As a Python list:

['    ', '    ', '    ', '    ', '    ', '    ', '    ', '    ', '    ', '    ', '    ', '))  ', '0290', '0398', '0866', '0887', '0892', '0992', '1108', '1268', '1297', '1339', '1555', '1722', '1817', '1848', '1930', '2328', '2521', '2611', '2747', '3179', '3192', '3245', '3284', '3334', '3613', '3862', '4086', '4629', '4639', '4674', '4695', '4781', '4968', '5723', '5742', '5791', '5938', '6011', '6069', '6180', '6231', '6265', '6269', '6444', '6564', '6776', '6884', '7116', '7253', '7348', '7440', '7527', '7743', '7873', '8064', '8291', '8808', '8843', '9305', '9324', '9458', '9460', '9586', '9869', '====', 'a,b,', 'abcd', 'c)-d', 'etri', 'pow(', 'prin', "s'*(", "t('T"]
\$\endgroup\$
  • \$\begingroup\$ I made a mistake and pasted too much. I've fixed it now, but rebuilders, please don't look through the edit history. \$\endgroup\$ – xnor Oct 22 '14 at 6:05
  • 2
    \$\begingroup\$ FYI, you fixed it within the grace period, so there's no edit history to worry about. \$\endgroup\$ – Nathaniel Oct 22 '14 at 6:17
  • \$\begingroup\$ The main list is missing two of the 4-space blocks. \$\endgroup\$ – feersum Oct 22 '14 at 16:07
  • \$\begingroup\$ @feersum Congrats! I totally didn't think of using overhangs like that. Time to make a new and better jumble. \$\endgroup\$ – xnor Oct 22 '14 at 18:57
  • 2
    \$\begingroup\$ Cracked btw. \$\endgroup\$ – feersum Oct 22 '14 at 20:32
3
\$\begingroup\$

Python 3: 160 area

After feersum's crack, I tried to tighten up my code to make it harder to avoid cryptographic mumbo-jumbo. It's made of 40 I pieces, listed one per row:

')    #Two spaces
)-d)
*'Te
,b,c
0484
0824
2448
2562
3094
3762
3896
4052
4233
4562
5266
5277
5400
5885
5927
5965
6080
6720
6808
6884
7568
7856
7963
8609
8639
8665
8732
8892
9206
9893
====
abcd
ow(a
prin
t((p
tris

As a Python list:

["')  ", ')-d)', "*'Te", ',b,c', '0484', '0824', '2448', '2562', '3094', '3762', '3896', '4052', '4233', '4562', '5266', '5277', '5400', '5885', '5927', '5965', '6080', '6720', '6808', '6884', '7568', '7856', '7963', '8609', '8639', '8665', '8732', '8892', '9206', '9893', '====', 'abcd', 'ow(a', 'prin', 't((p', 'tris']

Changed:

  • Reordered string multiplication to try to force pow to be used
  • Fewer spaces (though shorter numbers)
  • No 1's

I am worried about the many factors of the area though.

\$\endgroup\$
2
\$\begingroup\$

C - Area 72

Blocks:

I    J     _______ L ______       O      __ Z _     _______ T ______
          /                \   /    \   /      \   /                \
"    e    m   "   T   )   6    };  ii   3"   (.    \nn  {6"  ]"0  i%s
i    t    p   ,   &   m   1    -]  ar    "\   f(    t    8    e    T
s   )"    .[  0x  ,f  ai  0r
"  

 ""   (t   ["
)"   61   4+
\____   ____/
      S

Since the only other C submission was cracked. ;)

A neat 72 characters. Pure obfuscation. No NP-hard problems to solve or huge integers to factor. Borrows some tricks from one of the greats. Spaces are represented using .s. No actual .s appear in the solution.

I've triple-checked the solution to ensure validity of the pieces.

\$\endgroup\$
2
\$\begingroup\$

CJam, 80 area

20 O-pieces.

 I
`7

&d
'X

+5
7m

-2
`-

-6
#b

-O
U[

3Z
Pi

4"
2X

43
P"

?<
5b

D:
.=

FH
uL

K`
~C

QT
:c

[^
+9

aj
^F

hD
dP

tn
6 

uq
KG

x6
CF

-24"hD&d ID:uqx6tn-OajFH43[^+5?<3ZK`-6QT
`-2XdP'X`7.=KGCF6 U[^FuLP"+97m5bPi~C#b:c

I didn't rotate the bricks.

\$\endgroup\$
2
\$\begingroup\$

C - Area 780

There are 195 pieces in total. No comments were used. Nothing particularly complicated.

Note: all backslashes (\) are to be replaced with spaces.

95 I Pieces:

____ x12
incl
\edu
\\\\
\\\\
\\\\
dts<
h.oi
*_*>
_,_(
int\
__;\
,_(_
_*_,
=__,
__"*
+|_;
r__+
ahct
)=pu
_\ra
f\ch
edep
#t_,
y___
*_;_
(_;-
){__
,<_\
9"=_
+__*
___;
_+>_
_??<
+__*
*__,
__*_
*=+_
__:-
___-
_+__
,___
,__,
_,*&
*\&*
_,*_
_++,
+,__
++++
+__=
_++,
,,,_
___+
=+__
?++_
___+
=__+
,<_*
__+*
&+;*
+*__
__*_
__+,
++?~
__-9
_?__
__*_
(_+_
[**(
_<&_
};__
_@A:
(nia
@@@@
AAAA
AAAA
~~~~
_++;
_&,)
A__+
~~__
g_""
_;}_
+*__

35 O Pieces:

__
__
 (x18)
)_
__

_*
_\

_;
,-

_*
__

~)
"{

+_
+_

*_
,_

__
_)

~~
a~

_,
__

__
,)

_:
__

+*
__

__
+,

*+
_+

AA
AA

__
,+

18 L Pieces:

___
_
 (x2)
_;*
_
_=_
+
__*
_
+__
_
**_
&
+*_
_
&*&
,
++,
_
_*_
_
;;_
"
__+
_
AAA
~
"*)
;
___
(
,_-
_
_~^
_

25 J Pieces:

_+=
  +
+,_
  _
*__
  ;
;;_
  \
_,_
  )
~~~
  _
___
  A
~;(
  _
;__
  i
_;m
  A
=__
  _
a;a
  A
="A
  a
~_\
  o
o_a
  a
~~~
  _
99-
  _
*9_
  _
__)
  _
__*
  <
+_,
  _
_++
  =
_+_
  _
++_
  _
_+:
  _

10 T Pieces:

 _
,__
 +
*?_
 =
**=
 _
__+
 _
:_+
 _
_+_
 _
(_-
 +
++,
 +
___
 *
__:

4 Z Pieces:

=*
 ++
*+
 __
t_
 -~
__
 f(

8 S Pieces:

 _,
_,
 __
__
 (x2)
 -_
__
 (x2)
 _9
~_
 99
__
 __
],

Solution

#include <stdio.h> typedef char _________; int (* _____)()=putchar;____(_,___,__ ,______) _________*__,* *___,* ______;{__="9>?_|";______=*___ ;--_;--_<*__++?++*______,_+=_+ _:___,__,___;_<*__++?*______+= *______,++______,__,*______+=* ______,__,++______,*&*______+= *______,++______,* &*______+=* ______,++______,*&*&*______+=* ______,++______,_,*______+=*&* ______,_+=_+_:__,_;_<*__++?++* ______++,++*______++,++*______ ++,++*______++,++*&*______++,_ ,++*______,_+=_+_+_+_:______;_ <*__++?~_____(_-_+_-_)^~_____( *______),++*___,_____,_,_+=*&* ______,_+_:_____(_+_-_-_);;_<* __?--*______:___;}_________ _[ 999-99-99],*__=_;main(______){ _________*___="AAA@@@@@~~~~~~" "~~~~~~aAAAAAaAAAAAAAAAAAAA;;" "aa~~~~~~~~~a;a";_____:____((* ___-______),&__);if(__,*++___) goto _____;++______;++______;}

\$\endgroup\$
1
\$\begingroup\$

Wolfram, area 72

Everywhere you see a dash (-), replace it with a space

i

h01-

r*1/

j

6
115

l

  m
+1C

  t
*0e

  e
,,[

o

r4
a+

s

 10
-1

 +1
Pr

z

ro
 8*

ac
 -1

od
 +1

t

--F
 {

,50
 0

/]}  -- fixed bracket directions
 0

1-,
 ,

01C
 0

tni
 4
\$\endgroup\$
  • \$\begingroup\$ Do you mean Wolfram language (i.e. Mathematica)? All your brackets and braces point in the same direction - did you accidentally flip them around when rotating the blocks? \$\endgroup\$ – Martin Ender Oct 23 '14 at 19:16
  • 1
    \$\begingroup\$ Okay yes, the bracket and brace in third T block should be the other way round. I managed to rebuild it. \$\endgroup\$ – Martin Ender Oct 23 '14 at 19:42
  • \$\begingroup\$ Wolfram language, yes. Oh no, I did make a mistake! Congratulations for solving it despite that! \$\endgroup\$ – Gerli Oct 24 '14 at 8:25
  • \$\begingroup\$ I fixed the T. I printed out the code and rotated the paper to reduce mental exercise... I forgot to take into account the fact that the symbols changed as well... \$\endgroup\$ – Gerli Oct 24 '14 at 8:29
0
\$\begingroup\$

MATLAB, area 48

Unfortunately, it does not seem to work in Octave.

-
^-1

'
'u"

v'+
e

[['
;

'.i
]

lmi
a

 kv
hW

 .x
).

3)
t;

b(
'p

('l; 

.]'e
\$\endgroup\$
0
\$\begingroup\$

Python 3 176 Area

I don't use underscores in this program, so I decided to replace all spaces with underscores for added readablity. Make sure to replace them back to spaces when failing to put it back together.

I Blocks:

1456

"jtr

\)\~

tris

],i)

t=""

2697

t(t[

_r+2

_r_i

O Blocks:

i_
s_

_;
32

6#
an

".
+-

t)
in

n(
_[

""
(c

ap
ri

L Blocks:

  =
#14

  .
\n"

  ;
"(t

  i
T%"

  o
:=i

  r
ioj

  6
mp#

J Blocks:

6
2(h

5
574

#
"=t

7
spl

f
o__

s
(s_

n
];#

0    
t=_

*
#)(

T Blocks:

=_1
 _

295
 r

21,
 r

,2)
 .

Z Blocks:

46
 ""

"5
 3"

#t
 )n

1t
 ),

S Blocks:

 ge
34

 nt
68
\$\endgroup\$
0
\$\begingroup\$

Python 3

Area - 484

Spaces replaced by %. There are some comments used as padding. Quite a bit of repetition of code. May be quite complicated.

121 Os

41
)+

%r
1-

:#
1#

%r
1-

01
,+

a1
n+

))
0+

h1
r-

#0
##

--
ge

11
1-

hr
1-

--
-1

ap
0+

+1
+'

h0
r+

:1
##

11
1-

))
0+

a0
p+

n0
d+

f%
oz

-1
0+

hr
1-

n0
d+

a0
p+

a1
n+

+0
1+

hf
.=

i1
%-

f%
oa

a1
n+

(c
0+

(0
1+

0,
1+

i1
n+

in
1+

r+
%=

-0
1+

fo
%l

n'
d'

--
=1

p1
%-

-;
-a

-;
-h

a1
n+

pe
0+

pe
0+

-1
0+

n0
d+

11
0-

a0
p+

i1
n+

hz
.=

n0
d+

##
)#

5)
1+

g(
1-

%1
r-

(c
.j

(0
c+

11
0-

(z
n(

g(
1-

41
)+

)s
)'

in
1+

r+
%=

ap
in

g(
1-

01
,+

-a
-n

(l
1+

pt
e(

%1
r-

-#
]#

(1
f+

g1
(-

h.
l=

01
,+

h.
pr

:1
##

:#
1#

(1
z+

r+
%=

+1
0+

p0
e+

r%
+=

(a
0+

hz
.=

+0
1+

(0
c+

))
0+

#0
##

q%
1-

g1
e-

-0
1+

#0
##

pe
0+

-1
h)

61
)+

an
1+

--
ng

fo
%f

)0
)+

f%
oz

-=
-[

11
)+

q1
%-

:#
1#

+0
1+

--
=r

j1
%-

ho
ri

#-
ra

(0
c+

i1
n+

,1
8-

r+
%=

%1
r-

##
0#
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.