# Make a code square with your favorite word [closed]

Pick your favorite 6 letter common English word that has no repeated letters, such as wombat.

Write a program in an N×N grid of characters without comments such that each row and column contains all the letters of your word in lowercase in any order. The program must output a definition of your word in 36 characters or more.

# Rules

• Output to stdout. There is no input.
• Your word must be on Dictionary.com and only contain a-z. No proper nouns, no acronyms, no abbreviations, no contractions.
• Your program and output may only contain printable ASCII characters (hex codes 20 to 7E). (This isn't counting the necessary newlines in the program grid.)
• Comments are anything that the compiler or interpreter traditionally ignores. You may use code that does not contribute to the output or doesn't officially get executed.
• The output definition should be grammatical and accurate, but certainly may be funny or clever.
• Any row or column that at least contains your words 6 unique letters in lowercase is valid. Diagonals do not matter.

# Scoring

This is code golf but since all submissions must be in the same square format you can simply specify your score with N. The lowest N wins, and of course an N below 6 is impossible. In case of ties, the highest voted answer wins.

# Example

If your word was wombat your program might look like this (N = 7):

wombatD
ombatEw
mbatFwo
bat(wom
atWwomb
tBwomba
)wombat


Notice that every row and every column has the characters w o m b a t.

The output might be: (40 chararacters)

Cute short-legged Australian marsupials.

• OK, you have to create a grid using a 6 letter word, but then I do not understand the output: "Cute short-legged Australian marsupials.". Jul 30, 2014 at 7:59
• @CousinCocaine That's a description of a wombat. You should output a grammatical and accurate description of the word you choose. Jul 30, 2014 at 8:01
• As this is code golf, who decides whats right? "Cute short-legged Australian marsupials" or "short-legged marsupials"? Jul 30, 2014 at 8:03
• Idea: Have the word be "golfed", and the definition "a description of this program's code" (for anyone who can figure out how to do this!). Jul 30, 2014 at 9:17
• damn, i don't have favorite 6 character long word Jul 30, 2014 at 13:24

## Javascript - action - 15x15

"Definetly not the shortest one, but PEW PEW PEW." - James Bond

ction="action "
ction+="means "
actionac="PEW "
ctionact="PEW "
tionacti="PEW "
ionactio="PEW "
onaction="PEW "
nactiona="PEW "
ction+=actionac
ction+=ctionact
ction+=tionacti
ction+=ionactio
ction+=onaction
ction+=nactiona


Link to the jsfiddle

Output (37 chars):

action means PEW PEW PEW PEW PEW PEW

• Your first row should contain a lowercase a. Jul 30, 2014 at 9:23
• @Calvin'sHobbies You are right. I fixed it. Jul 30, 2014 at 9:25

# Befunge 93, n=13

This works by redirecting the string with "v and >". This only works when the side-length and word-length are coprime and when the side-length is greater than 11. Right now, it works for the "word" vwombat, and therefore for wombat.

"laip"vwombat
wombat>"usr"v
"am "vwombat>
ombat>"nai"vw
lar"vwombat>"
mbat>"tsu"vwo
d"vwombat>"A
bat>"egg"vwom
-"vwombat>"el
at>"tro"vwomb
"vwombat>"hs
t>"tuC"vwomba
vwombat>:#,_@


Outputs Cute short-legged Australian marsupial

# C (word : "finder", N = 16)

main() finder{ f
printf(finder  i
"it's defined "r
"as a t"finder d
"hing t"finder e
"hat ca"finder r
"n find other t"
"hings" finder);
finder finder f\
inder finder fi\
nder finder fin\
der finder find\
er finder finde\
r finder finder
finder finder n
return 0;finder}


Compiled with GCC, with the options -Dfinder="" -Df="" -Di="" -Dn="" -Dd="" -De="" -Dr="".

It outputs it's defined as a thing that can find other things (50 characters). I believe it follows all the rules, but feel free to tell me if there is any mistake !

• Looks correct, though I'm not crazy about all the compiler options. Jul 30, 2014 at 9:08
• Of course, I bent the rules a little here. At first I was going for a lot of defines, that's why I chose the word "finder" (since it contains almost the same letters as "define"). Jul 30, 2014 at 9:11
• its not a good idea to use macros. if it's allowed, you can say n=6 and compile it with these: "-Dfinder=main(){puts(it's defined as a thing that can find other things);}" -Dinderf=; -Dnderfi=; -Dderfin=; -Derfind=; -Dnderfi=;
– bebe
Jul 30, 2014 at 10:08
• That's right, I didn't even think of that. Jul 30, 2014 at 10:12

### GolfScript, N = 12

wombat"Cute"
ombat" sho"w
mbat"rt-l"wo
bat"egge"wom
at"d Au"womb
twomb"stra"a
wom"lian "bt
ttwomb"mar"t
"sup"wbwomat
"ia"womabbtt
"ls"bawomtbt
aaawomobt"."


The wombat example encoded in GolfScript. Output is

Cute short-legged Australian marsupials.


as given in the question. The interesting part is that you may use most words and answers and simply insert the corresponding letters into the solution as long as you don't produce a GolfScript built-in which are very rare, p, n being to obvious ones. All other combinations lead to valid GolfScript variables which are no-ops by default.

• So I guess one could cut this down significantly with a clever phrase that uses a lot of the letters from the word. Jul 30, 2014 at 17:53
• @MartinBüttner I tried, but the 36 characters make it quite hard. Jul 30, 2014 at 17:55
• I used your approach for a "square" submission (see below). It's actually one character larger than yours, but with some clever shifting around it might be possible to compress it. Aug 2, 2014 at 19:35

## Perl - grapes - 11

edit: I accidently made this 12 lines...

$epagsr=$";
$,=$epagsr;
/gaerp/;say
grep!/a*s/,
qw(A searpg
purple sgar
rpssg pear?
No, a sgerp
s great pse
as grape; s
eat prgpsga
up! sgarse)


Output:

A purple pear? No, a great grape; eat up!


# Update!

I eliminated a line to get it down to 11 but I had to change the sentence. Hopefully I didn't make any mistakes this time!

$gpasre=$";
$,=$gpasre;
/paerg/;say
grep!/a*s/,
qw(A sgrpea
purple sarg
ressp game?
No, a rgspe
s great gsp
as grape; s
eat),$spegr  Output: A purple game? No, a great grape; eat  The output is 37 characters. • I like this one primarily because of the little output poem. Shame it wasn't a haiku :) Aug 2, 2014 at 11:10 • This is 12x11... Aug 3, 2014 at 5:30 • @schism wow... Shoot! I'll fix it. Thanks! Aug 3, 2014 at 15:06 • About to accept this, but it's still 12 tall. Oct 19, 2014 at 6:11 ## Befunge-98 (n=12) I chose kelvin because it had a v in it. Outputs kelvin is like celsius but it's lowe "ewol "vnlik "t's"ke<ilnv kelniv"t i"< elnik>"ub "v nkv"elsius"< ln>"c eki"vl v0ke"is l"<n >" nivlek" v ielnv,k4'k#< vivlevlnek< ilkkninevei elnkn vnle  • unfortunately, Si temp is 29 characters short of 36. ;) Jul 30, 2014 at 18:14 • It seems that whenever I post in Befunge-93, someone follows up with a similar Befunge-98 solution... – Zaq Jul 30, 2014 at 18:14 • @Zaq don't worry, -93 is more fun anyways. Jul 30, 2014 at 19:06 • Line 2 has no i. Aug 3, 2014 at 5:16 • Also, line 4 is missing a k and column 9 is missing an e. Aug 3, 2014 at 5:28 ## Python, n=15 Word is "canoes" def canoe(s='S\ ecret weap',sno ='ce',a='ons o\ f the Can',oces =1,oesn=1,c='a\ dian navy',cose ="""aoenscanaen canceessanoeeca anoasanooscanoe noescccccaeescc oescneocaeoesca escaoescan"""): canoes=s + a+c print (canoes) s=1; canoe()  Output: Secret weapon of the Canadian navy  • This is 16x15!​ Aug 3, 2014 at 5:33 • Thanks...at some point I miscounted and felt the need to add that single line with canoes in there. Fixed. Aug 3, 2014 at 12:40 ## Perl - repeat - 11 $repeat=qq(
repeat);say
"repeat\n"x
length'pear
repeatrepea
epeatrepeat
peatrepeatr
eatrepeatre
atrepeatrep
trepeatrepe
repeat....'


Output:

repeat
repeat
repeat
repeat
...keeps going


Looking back maybe I should have made this a loop.

• Falls short of the word that has no repeated letters requirement. Jul 30, 2014 at 20:46
• @Howard There are at least 2 e's per line though so I figured I might as well post it. Jul 30, 2014 at 20:48

# Ruby, haters, N = 10

After hours of attempts by hand, writing a generator program, and tweaking parameters, I have finally found a solution for N = 10!

aser=ts=?h
tah=re=?\s
sh='Haters
nurse hate
in hardest
hearts.'
rtse=erha=
era=sh.tr'
',tah;aser
puts erha


Outputs Haters nurse hate in hardest hearts., exactly 36 characters. Try it online!

I chose Ruby because its variables don't need \$ (Perl), and single-quoted strings can contain newlines (Python). The fact that the tr method uses two of my word's letters was an unexpected bonus. The core of the program is straightforward:

# Store the definition, with newlines
sh='Haters
nurse hate
in hardest
hearts.'
# Transliterate newline to space
erha=sh.tr('
',' ')
# Output
puts erha


Getting all the letters to line up, of course, was not simple. I went through several variations on the same structure and learned a couple things about Ruby in the process (tr doesn't need parentheses, and ?\s is another way of getting a space). There were many dead ends and several false positives. And then... success!

Here's a gist of my hacked-together generator program, if anyone's interested.

## Golfscript (n=10)

My first golfscript! It prints kelvin is like celsius but it's lowe

"kelvin is
like ce"vn
evn"lsiu"k
k"s "elvni
in"bu"kelv
"t "knviel
vl"it'"nke
nevkil"s l
o"ivnkel"w
e"lnevik

• What does "lowe" mean? Aug 1, 2014 at 0:12
• dictionary.com says that it can mean low Aug 1, 2014 at 15:51
• That only refers to the verb, meaning: to burn; blaze / (of a person) to feel strong emotions; glow with excitement. I don't see how that works here. Aug 2, 2014 at 5:52
• Look at the quote on the top right of the page Aug 2, 2014 at 21:59
• Sorry, but "lowe" is a bit too obscure. I'll accept this if you can make it "low" or "lower". Oct 19, 2014 at 6:13

## GolfScript, 13x13

Not the smallest...

squae"A squar
"uarsquaresqu
uareq"e has f
"resuaresquar
resqa"our equ
"squresquares
quars"al side
"arequaresqua
areuq"s and r
"esqaresquare
esqur"ight an
"quaesquaresq
quar"gles..."


... but ...

A squar
e has f
our equ
al side
s and r
ight an
gles...


(Having the line-breaks within the words is intentional, because otherwise I'd have leading or trailing whitespace which would look less square.)

## Python, N=11

Word is "parent". This code is not pretty, but it works.

eprnt=" a "
at="person"
rnep="that"
ea= " prnt"
e="parent:"
pa =(eprnt+
at+" "+rnep
+ea[0]+nrpt
+ eprnt+at)
print(e+pa)


Output: parent: a person that made a person

Edit: Somehow I missed the fact that columns must also contain the word. In retrospect, a language that includes endline characters as part of the language was not well suited to this puzzle.

• Nice, but not every column contains the word parent. The first one, for example, does not have an a. Jul 31, 2014 at 17:24
• It's still missing a bunch. p is missing in 6 and 8. a: 4, 6, 7, 11. r: 4, 10, 11. e: 4, 5, 8, 9, 11. n: 3, 5, 7, 11. t: 1, 3, 6, 8. Aug 3, 2014 at 5:32

# Pip, n=14 (noncompeting)

The language is newer than the question. The word is quines.1

n_n|quine say&
qu ines     qi
as  harle quin
se?(equins)ns.
plums|quinces
|quicken bus++
iness|q++++i u
u:++ingl es?eq
ni*:u; s|qe:",
which "Rns|que
eRL:i|quotesne
PUsn    quiet!
u|qe."print".s
JW"quines"  :)


Outputs the following (admittedly incomplete) definition:

quines print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines, which print quines

Try it online!

The meaningful part of the code runs thus:

++i          Increment i (initially set to 0)
++++i        Increment i twice
u:++i        Increment i again and assign to u (i & u are now 4)
i*:u         Multiply i by u in-place (i is now 16)
e:",         Assign the string ",\nwhich " to e...
which "Rns   after replacing the newline with a space
eRL:i        Make a list of 16 copies of e and assign back to e
ePUs         Push a space to the front of list e
e."print".s  Concatenate "print" and a space to each element of e...
JW"quines"   and join on "quines", wrapping the result in "quines"


The rest of the code is arbitrary no-ops. The main difficulty in the "filler" sections was never to evaluate q, since it will prompt the user for a line of input (not a problem on TIO, but I wanted to make it correct in all environments). I used short-circuiting logic operators | and &, and ternary ?, to prevent q's evaluation.

1 Dictionary.com has an entry for quine, with a section on the programming meaning at the bottom. Since "quine" is a countable noun, I would argue that "quines" is a valid word.

# Javascript, N = 8

My word is alerts.

s= alert
aaltrsee
leraatts
ertsalar
rtsaaela
tsaesarl
`

My code outputs the definition of the javascript alert function multiple times. Javascript's definition of alert is "function alert() { [native code] }".

Only the first three lines of code actually contribute to the output. The last 5 lines are syntax errors but the original rules stated that not all the code has to be executed as long as the output is correct.

Here is a link to the fiddle: http://jsfiddle.net/tze76pum/

• Nice, but not quite common English. Oct 19, 2014 at 6:06