Take the 2-minute tour ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

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

13 Answers 13

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 
share|improve this answer
    
Your first row should contain a lowercase a. –  Calvin's Hobbies Jul 30 at 9:23
    
@Calvin'sHobbies You are right. I fixed it. –  izlin Jul 30 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

share|improve this answer

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 !

share|improve this answer
3  
Looks correct, though I'm not crazy about all the compiler options. –  Calvin's Hobbies Jul 30 at 9:08
1  
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"). –  maxdefolsch Jul 30 at 9:11
9  
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 at 10:08
    
That's right, I didn't even think of that. –  maxdefolsch Jul 30 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.

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

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

Perl - grapes - 11

$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!
share|improve this answer
    
I like this one primarily because of the little output poem. Shame it wasn't a haiku :) –  Matt Fletcher Aug 2 at 11:10
1  
This is 12x11... –  Schism Aug 3 at 5:30
    
@schism wow... Shoot! I'll fix it. Thanks! –  chilemagic Aug 3 at 15:06

Swift n=15

var (Teil, p)=(
" ", "le trip")
let riplet = 42
var pi = riplet
let (j, pig, r,
i, ltr, pe) = (
"This", "pler",
"is", "trplet",
"ple. ", "tri")
var pliert = -1
while pliert<2{
print(j + Teil)
print(r + Teil)
print(pe + ltr)
pliert+=1};pi++

Outputs "This is triple. This is triple. This is triple."

share|improve this answer
4  
Line 4 has no t. –  Kevin Jul 31 at 6:42
1  
Thanks. Done, and a ripple becomes a riplet. –  codingTheHole Aug 1 at 9:13
1  
This doesn't have the characters of the word in each column though, only the rows... –  Matt Fletcher Aug 2 at 11:08
    
Back to the drawing board. Again. –  codingTheHole Aug 4 at 9:57

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.

share|improve this answer
9  
Falls short of the word that has no repeated letters requirement. –  Howard Jul 30 at 20:46
3  
@Howard There are at least 2 e's per line though so I figured I might as well post it. –  chilemagic Jul 30 at 20:48

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
share|improve this answer
    
What does "lowe" mean? –  aditsu Aug 1 at 0:12
1  
dictionary.com says that it can mean low –  waylon531 Aug 1 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. –  aditsu Aug 2 at 5:52
    
Look at the quote on the top right of the page –  waylon531 Aug 2 at 21:59
    
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 Aug 3 at 7:22

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
share|improve this answer
    
This is 16x15!​ –  Schism Aug 3 at 5:33
    
Thanks...at some point I miscounted and felt the need to add that single line with canoes in there. Fixed. –  Gerrat Aug 3 at 12:40

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

share|improve this answer

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.

share|improve this answer
4  
Nice, but not every column contains the word parent. The first one, for example, does not have an a. –  ProgramFOX Jul 31 at 17:24
1  
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. –  Schism Aug 3 at 5:32

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/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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