47
\$\begingroup\$

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.
\$\endgroup\$
  • \$\begingroup\$ 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.". \$\endgroup\$ – CousinCocaine Jul 30 '14 at 7:59
  • \$\begingroup\$ @CousinCocaine That's a description of a wombat. You should output a grammatical and accurate description of the word you choose. \$\endgroup\$ – ProgramFOX Jul 30 '14 at 8:01
  • \$\begingroup\$ As this is code golf, who decides whats right? "Cute short-legged Australian marsupials" or "short-legged marsupials"? \$\endgroup\$ – CousinCocaine Jul 30 '14 at 8:03
  • 5
    \$\begingroup\$ 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!). \$\endgroup\$ – Doorknob Jul 30 '14 at 9:17
  • 6
    \$\begingroup\$ damn, i don't have favorite 6 character long word \$\endgroup\$ – user902383 Jul 30 '14 at 13:24

14 Answers 14

18
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ I like this one primarily because of the little output poem. Shame it wasn't a haiku :) \$\endgroup\$ – Matt Fletcher Aug 2 '14 at 11:10
  • 1
    \$\begingroup\$ This is 12x11... \$\endgroup\$ – Schism Aug 3 '14 at 5:30
  • \$\begingroup\$ @schism wow... Shoot! I'll fix it. Thanks! \$\endgroup\$ – hmatt1 Aug 3 '14 at 15:06
  • \$\begingroup\$ About to accept this, but it's still 12 tall. \$\endgroup\$ – Calvin's Hobbies Oct 19 '14 at 6:11
47
\$\begingroup\$

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 
\$\endgroup\$
  • \$\begingroup\$ Your first row should contain a lowercase a. \$\endgroup\$ – Calvin's Hobbies Jul 30 '14 at 9:23
  • \$\begingroup\$ @Calvin'sHobbies You are right. I fixed it. \$\endgroup\$ – izlin Jul 30 '14 at 9:25
35
\$\begingroup\$

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

\$\endgroup\$
25
\$\begingroup\$

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 !

\$\endgroup\$
  • 3
    \$\begingroup\$ Looks correct, though I'm not crazy about all the compiler options. \$\endgroup\$ – Calvin's Hobbies Jul 30 '14 at 9:08
  • 1
    \$\begingroup\$ 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"). \$\endgroup\$ – maxdefolsch Jul 30 '14 at 9:11
  • 9
    \$\begingroup\$ 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=; \$\endgroup\$ – bebe Jul 30 '14 at 10:08
  • \$\begingroup\$ That's right, I didn't even think of that. \$\endgroup\$ – maxdefolsch Jul 30 '14 at 10:12
21
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ So I guess one could cut this down significantly with a clever phrase that uses a lot of the letters from the word. \$\endgroup\$ – Martin Ender Jul 30 '14 at 17:53
  • \$\begingroup\$ @MartinBüttner I tried, but the 36 characters make it quite hard. \$\endgroup\$ – Howard Jul 30 '14 at 17:55
  • \$\begingroup\$ 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. \$\endgroup\$ – Martin Ender Aug 2 '14 at 19:35
18
\$\begingroup\$

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
\$\endgroup\$
  • \$\begingroup\$ unfortunately, Si temp is 29 characters short of 36. ;) \$\endgroup\$ – Martin Ender Jul 30 '14 at 18:14
  • \$\begingroup\$ It seems that whenever I post in Befunge-93, someone follows up with a similar Befunge-98 solution... \$\endgroup\$ – Zaq Jul 30 '14 at 18:14
  • \$\begingroup\$ @Zaq don't worry, -93 is more fun anyways. \$\endgroup\$ – seequ Jul 30 '14 at 19:06
  • \$\begingroup\$ Line 2 has no i. \$\endgroup\$ – Schism Aug 3 '14 at 5:16
  • \$\begingroup\$ Also, line 4 is missing a k and column 9 is missing an e. \$\endgroup\$ – Schism Aug 3 '14 at 5:28
11
\$\begingroup\$

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
\$\endgroup\$
  • \$\begingroup\$ This is 16x15!​ \$\endgroup\$ – Schism Aug 3 '14 at 5:33
  • \$\begingroup\$ Thanks...at some point I miscounted and felt the need to add that single line with canoes in there. Fixed. \$\endgroup\$ – Gerrat Aug 3 '14 at 12:40
10
\$\begingroup\$

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.

\$\endgroup\$
  • 12
    \$\begingroup\$ Falls short of the word that has no repeated letters requirement. \$\endgroup\$ – Howard Jul 30 '14 at 20:46
  • 3
    \$\begingroup\$ @Howard There are at least 2 e's per line though so I figured I might as well post it. \$\endgroup\$ – hmatt1 Jul 30 '14 at 20:48
6
\$\begingroup\$

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.

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

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
\$\endgroup\$
  • \$\begingroup\$ What does "lowe" mean? \$\endgroup\$ – aditsu Aug 1 '14 at 0:12
  • 1
    \$\begingroup\$ dictionary.com says that it can mean low \$\endgroup\$ – waylon531 Aug 1 '14 at 15:51
  • \$\begingroup\$ 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. \$\endgroup\$ – aditsu Aug 2 '14 at 5:52
  • \$\begingroup\$ Look at the quote on the top right of the page \$\endgroup\$ – waylon531 Aug 2 '14 at 21:59
  • 1
    \$\begingroup\$ Sorry, but "lowe" is a bit too obscure. I'll accept this if you can make it "low" or "lower". \$\endgroup\$ – Calvin's Hobbies Oct 19 '14 at 6:13
5
\$\begingroup\$

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

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

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.

\$\endgroup\$
  • 4
    \$\begingroup\$ Nice, but not every column contains the word parent. The first one, for example, does not have an a. \$\endgroup\$ – ProgramFOX Jul 31 '14 at 17:24
  • 2
    \$\begingroup\$ 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. \$\endgroup\$ – Schism Aug 3 '14 at 5:32
2
\$\begingroup\$

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.

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

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/

\$\endgroup\$
  • 1
    \$\begingroup\$ Nice, but not quite common English. \$\endgroup\$ – Calvin's Hobbies Oct 19 '14 at 6:06

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.