Make a code square with your favorite word

47

5

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 word`s 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.

Calvin's Hobbies

Posted 2014-07-30T07:42:30.767

Reputation: 84 000

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.". – CousinCocaine – 2014-07-30T07:59:23.167

@CousinCocaine That's a description of a wombat. You should output a grammatical and accurate description of the word you choose. – ProgramFOX – 2014-07-30T08:01:55.520

As this is code golf, who decides whats right? "Cute short-legged Australian marsupials" or "short-legged marsupials"? – CousinCocaine – 2014-07-30T08:03:34.870

Right. The example grid is not of course a real program, just a theoretical one that somehow encodes the description while meeting the other constraints. I imagine N will have be much larger than 7. – Calvin's Hobbies – 2014-07-30T08:04:14.277

@CousinCocaine The output can be any decent definition of your word. But it must be at least 36 characters (see spec). – Calvin's Hobbies – 2014-07-30T08:05:12.163

Is it OK if a letter of your word is in uppercase in your program? – ProgramFOX – 2014-07-30T08:05:13.363

@ProgramFOX Sure, as long as all the lowercase letters are in there too. wombatW or WOMBATbatwom would be fine for the first row but not wombaT. – Calvin's Hobbies – 2014-07-30T08:08:37.303

@MartinBüttner Space counts as printable ASCII. Wont that suffice? – Calvin's Hobbies – 2014-07-30T08:26:16.770

@Calvin'sHobbies never mind, I didn't check the link and figured all whitespace was excluded because you specifically allowed newlines. – Martin Ender – 2014-07-30T08:30:21.207

5Idea: 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!). – Doorknob – 2014-07-30T09:17:06.740

6damn, i don't have favorite 6 character long word – user902383 – 2014-07-30T13:24:01.147

I really want to make one using the word square, but I don't have the skills :(. – TMH – 2014-08-01T13:38:05.017

@TomHart I gave that a go

– Martin Ender – 2014-08-02T19:32:52.987

Answers

18

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.

hmatt1

Posted 2014-07-30T07:42:30.767

Reputation: 3 356

I like this one primarily because of the little output poem. Shame it wasn't a haiku :) – Matt Fletcher – 2014-08-02T11:10:03.533

1This is 12x11... – Schism – 2014-08-03T05:30:23.223

@schism wow... Shoot! I'll fix it. Thanks! – hmatt1 – 2014-08-03T15:06:50.877

About to accept this, but it's still 12 tall. – Calvin's Hobbies – 2014-10-19T06:11:46.013

47

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
alert(""+ction)

Link to the jsfiddle

Output (37 chars):

action means PEW PEW PEW PEW PEW PEW 

izlin

Posted 2014-07-30T07:42:30.767

Reputation: 1 497

Your first row should contain a lowercase a. – Calvin's Hobbies – 2014-07-30T09:23:19.427

@Calvin'sHobbies You are right. I fixed it. – izlin – 2014-07-30T09:25:30.273

35

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

Zaq

Posted 2014-07-30T07:42:30.767

Reputation: 1 525

25

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 !

maxdefolsch

Posted 2014-07-30T07:42:30.767

Reputation: 367

3Looks correct, though I'm not crazy about all the compiler options. – Calvin's Hobbies – 2014-07-30T09:08:29.853

1Of 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"). – maxdefolsch – 2014-07-30T09:11:28.600

9its 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 – 2014-07-30T10:08:35.650

That's right, I didn't even think of that. – maxdefolsch – 2014-07-30T10:12:34.477

21

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.

Howard

Posted 2014-07-30T07:42:30.767

Reputation: 23 109

So I guess one could cut this down significantly with a clever phrase that uses a lot of the letters from the word. – Martin Ender – 2014-07-30T17:53:06.503

@MartinBüttner I tried, but the 36 characters make it quite hard. – Howard – 2014-07-30T17:55:41.503

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. – Martin Ender – 2014-08-02T19:35:45.033

18

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

waylon531

Posted 2014-07-30T07:42:30.767

Reputation: 411

unfortunately, Si temp is 29 characters short of 36. ;) – Martin Ender – 2014-07-30T18:14:18.383

It seems that whenever I post in Befunge-93, someone follows up with a similar Befunge-98 solution... – Zaq – 2014-07-30T18:14:31.513

@Zaq don't worry, -93 is more fun anyways. – seequ – 2014-07-30T19:06:28.970

Line 2 has no i. – Schism – 2014-08-03T05:16:15.937

Also, line 4 is missing a k and column 9 is missing an e. – Schism – 2014-08-03T05:28:19.647

I believe I've fixed all the missing characters now, let me know if there's anything else I missed. – waylon531 – 2014-08-04T16:15:43.827

11

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

Gerrat

Posted 2014-07-30T07:42:30.767

Reputation: 221

This is 16x15!​ – Schism – 2014-08-03T05:33:03.150

Thanks...at some point I miscounted and felt the need to add that single line with canoes in there. Fixed. – Gerrat – 2014-08-03T12:40:18.157

10

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.

hmatt1

Posted 2014-07-30T07:42:30.767

Reputation: 3 356

12Falls short of the word that has no repeated letters requirement. – Howard – 2014-07-30T20:46:15.317

3@Howard There are at least 2 e's per line though so I figured I might as well post it. – hmatt1 – 2014-07-30T20:48:10.787

6

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.

DLosc

Posted 2014-07-30T07:42:30.767

Reputation: 21 213

5

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

waylon531

Posted 2014-07-30T07:42:30.767

Reputation: 411

What does "lowe" mean? – aditsu quit because SE is EVIL – 2014-08-01T00:12:56.107

1dictionary.com says that it can mean low – waylon531 – 2014-08-01T15:51:06.180

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. – aditsu quit because SE is EVIL – 2014-08-02T05:52:27.223

Look at the quote on the top right of the page – waylon531 – 2014-08-02T21:59:05.970

That's Middle English, not exactly the same language. In fact, it's unreadable to me. But.. whatever, I don't really care that much. – aditsu quit because SE is EVIL – 2014-08-03T07:22:30.537

1Sorry, but "lowe" is a bit too obscure. I'll accept this if you can make it "low" or "lower". – Calvin's Hobbies – 2014-10-19T06:13:07.600

5

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.)

Martin Ender

Posted 2014-07-30T07:42:30.767

Reputation: 184 808

4

Python, N=11

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

eprnt=" a "
at="person"
rnep="that"
nrpt="made"
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.

Thomas

Posted 2014-07-30T07:42:30.767

Reputation: 149

4Nice, but not every column contains the word parent. The first one, for example, does not have an a. – ProgramFOX – 2014-07-31T17:24:33.577

2It'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. – Schism – 2014-08-03T05:32:19.353

2

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.

DLosc

Posted 2014-07-30T07:42:30.767

Reputation: 21 213

1

Javascript, N = 8

My word is alerts.

s= alert
alert(s+
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/

Rhubarb Custard

Posted 2014-07-30T07:42:30.767

Reputation: 374

1Nice, but not quite common English. – Calvin's Hobbies – 2014-10-19T06:06:13.117