8
\$\begingroup\$

Objective:

  • Write one program that outputs sourcecode for another program that outputs words.

General information:

  • Any programming language.

Rules:

  1. Your programs should not take any input. (from user, filename, network or anything).
  2. The generated program sourcecode must not be in the same programming language as the original.
  3. The output from the generated program should be exactly every third character from the original sourcecode, starting at character #3 (first character in sourcecode is #1).
  4. Sourcecode constraints: Maximum 1500 characters
  5. Sourcecode constraints for generated program: Maximum 250 characters

Scoring is based on the output from the generated program, you get points for the following words (any combination of upper/lowercase):

me - 2 points
ore - 3 points
freq - 5 points
pager - 7 points
mentor - 11 points
triumph - 13 points
equipage - 17 points
equipment - 19 points
equivalent - 23 points
equilibrium - 29 points
unubiquitous - 31 points
questionnaire - 37 points

Each word can be repeated but lose 1 point for each repetition. For example:

  • four of Equilibrium (in any place) in the output gives: 29+28+27+26 points.

Letters in the output can be used in more than one word, for example:

  • equipager = equipage and pager = 17+7 points.

Best score wins. Good luck, have fun!

\$\endgroup\$
  • 1
    \$\begingroup\$ I don't get the Rule 3! What do you mean? Can you write down an example? \$\endgroup\$ – Vereos Jan 18 '14 at 14:29
  • \$\begingroup\$ If the sourcecode is this: print("hello") then the output from the generated code must be exactly: i(eo . The output from the generated code can therefor be maximum 500 characters long (since the original sourcecode is limited to 1500 characters). \$\endgroup\$ – Plarsen Jan 18 '14 at 14:34
  • 2
    \$\begingroup\$ @Plarsen: Shouldn't you update your question then? Now it says "Maximum 250 characters" for the generated program, but in your comment you say "500 characters". \$\endgroup\$ – ProgramFOX Jan 18 '14 at 14:43
  • 1
    \$\begingroup\$ the maximum sourcecode size for the generated program is 250, but it can output up to 500 characters (if the original sourcecode is 1500 characters) \$\endgroup\$ – Plarsen Jan 18 '14 at 14:45
  • \$\begingroup\$ Am I correct in thinking that 'mentor' and 'equipment' should get a bonus of 2 points for containing 'me'? \$\endgroup\$ – Kendall Frey Jan 18 '14 at 15:44
2
\$\begingroup\$

Befunge-98, produces zsh script: 150 1053 1113 1139 points

The Befunge-98 program (1500)

:#q #u!#e!#sa#t7#i6#o*#n*#n*#aj#ib#r9#e*#q:#u:#i:#p:#a:#g:#e:#r:#e:#q3#u+#i,#pc#m+#e,#nf#t+#o,#r4#e8#q*#u,#i6#l+#i:#b,#r4#i8#u*#m,#e,#qb#u+#i:#p:#m:#e:#n:#t,#o4#r8#e*#q,#u,#i4#l8#i*#b,#r,#i4#u8#m*#u,#n,#u4#b8#i*#q,#u,#i4#t8#o*#u,#s,#q4#ua#e*#s-#t,#i2#o+#n,#n,#a5#i+#r,#ec#q+#u,#i4#v8#a*#l,#e9#n5#t*#-,#qb#ua#e*#s,#t4#i8#o*#n,#n #a #i #r #e #q #u #i #p #a #g #e #r #e #q #u #i #p #m #e #n #t #o #r #e #q #u #i #l #i #b #r #i #u #m #e #q #u #i #p #m #e #n #t #o #r #e #q #u #i #l #i #b #r #i #u #m #u #n #u #b #i #q #u #i #t #o #u #s #q #u #e #s #t #i #o #n #n #a #i #r #e #q #u #i #v #a #l #e #n #t #- #q #u #e #s #t #i #o #n #n #a #i #r #e #q #u #i #p #a #g #e #r #e #q #u #i #p #m #e #n #t #o #r #e #q #u #i #l #i #b #r #i #u #m #e #q #u #i #p #m #e #n #t #o #r #e #q #u #i #l #i #b #r #i #u #m #u #n #u #b #i #q #u #i #t #o #u #s #q #u #e #s #t #i #o #n #n #a #i #r #e #q #u #i #v #a #l #e #n #t #- #q #u #e #s #t #i #o #n #n #a #i #r #e #q #u #i #p #a #g #e #r #e #q #u #i #p #m #e #n #t #o #r #e #q #u #i #l #i #b #r #i #u #m #e #q #u #i #p #m #e #n #t #o #r #e #q #u #i #l #i #b #r #i #u #m #u #n #u #b #i #q #u #i #t #o #u #s #q #u #e #s #t #i #o #n #n #a #i #r #e #q #u #i #v #a #l #e #n #t #- #q #u #e #s #t #i #o #n #n #a #i #r #e #q #u #i #p #a #g #e #r #e #q #u #i #p #m #e #n #t #o #r #e #q #u #i #l #i #b #r #i #u #m #e #q #u #i #p #m #e #n #t #o #r #e #q #u #i #l #i #b #r #i #u #m #u #n #u #b #i #q #u #i #t #o #u #s:#q2#u+#e0#sg#t,#i3#o+#n:#n #a3#i9#rb#e*#q*#u #i`#v #a!#l #e1#n+jt@#-

produces the zsh shell script (127)

for i in n n n n n;echo -n questionnairequipagerequipmentorequilibriumequipmentorequilibriumunubiquitousquestionnairequivalent-

which in turn of course outputs (500)

questionnairequipagerequipmentorequilibriumequipmentorequilibriumunubiquitousquestionnairequivalent-questionnairequipagerequipmentorequilibriumequipmentorequilibriumunubiquitousquestionnairequivalent-questionnairequipagerequipmentorequilibriumequipmentorequilibriumunubiquitousquestionnairequivalent-questionnairequipagerequipmentorequilibriumequipmentorequilibriumunubiquitousquestionnairequivalent-questionnairequipagerequipmentorequilibriumequipmentorequilibriumunubiquitousquestionnairequivalent-

when executed. This is worth 1139 points (assuming my calculations are correct).

Early version (saved here because it's much easier to try to understand)

The Befunge-98 program

:#m #e!#n!#tb#o9#r*#e*#qj#ub#i9#l*#i:#b:#r:#u2#m+#f,#r,#e5#q+#u,#ec#s+#t,#i8#o4#n*#n,#a #r #i #e #q #u #i #p #m #e #n #t #r #i #u:#m2#p+#h0#ug#n,#u3#b+#i:#qf#uf#i*#t`#o5ju @s#_

produces the Bourne shell script (including a bunch of trailing spaces)

echo mentorequilibrumfrequestionnariequipmentriumphunubiquitous                  

Here is the same program transposed, for easier reading.

: !!b9**jb9*:::2+,,5+,c+,84*,              :2+0g,3+:ff*`5 #
########################################################j@_
mentorequilibrumfrequestionnariequipmentriumphunubiquitous
\$\endgroup\$
  • \$\begingroup\$ I knew someone was going to use echo as the second step eventually. :) \$\endgroup\$ – Kendall Frey Jan 18 '14 at 22:02
  • \$\begingroup\$ I considered leaving it out and calling the target language "English" or "/bin/cat", but that would probably be a tad cheaty. :P \$\endgroup\$ – FireFly Jan 18 '14 at 22:05
2
\$\begingroup\$

Shellscript and Python - 514 Points

My submission is written in shellscript:

echo   print"'h rthtq""u""e""s""t""i""o""n""n""a""i""r""e""q""u""e""s""t""i""o""n""n""a""i""r""e""q""u""e""s""t""i""o""n""n""a""i""r""e""q""u""e""s""t""i""o""n""n""a""i""r""e""q""u""e""s""t""i""o""n""n""a""i""r""e""q""u""e""s""t""i""o""n""n""a""i""r""e""q""u""e""s""t""i""o""n""n""a""i""r""e""q""u""e""s""t""i""o""n""n""a""i""r""e""u""n""u""b""i""q""u""i""t""o""u""s""u""n""u""b""i""q""u""i""t""o""u""s""u""n""u""b""i""q""u""i""t""o""u""s""u""n""u""b""i""q""u""i""t""o""u""s""u""n""u""b""i""q""u""i""t""o""u""s""e""q""u""i""l""i""b""r""i""u""m""e""q""u""i""l""i""b""r""i""u""m""e""q""u""i""l""i""b""r""i""u""m""e""n""t""o""r""e""q""u""i""p""m""e""n""t""o""r""e""q""u""i""p""m""e""n""t""o""r""e""q""u""i""p""m""e""n""t""o""r'"

It will output the following python code (249 characters):

print'h rthtquestionnairequestionnairequestionnairequestionnairequestionnairequestionnairequestionnairequestionnaireunubiquitousunubiquitousunubiquitousunubiquitousunubiquitousequilibriumequilibriumequilibriumentorequipmentorequipmentorequipmentor'

Whose output contains:

8 * questionnaire: 37+36+35+34+33+32+31+30
5 * unubiquitous: 31+30+29+28+27
3 * equipment: 19+18+17
4 * mentor: 11+10+9+8
3 * ore: 3+2+1
6 * me: 2+1

for a total of 514 Points.

Not very sophisticated, i am sure others can do better :)

\$\endgroup\$
  • 1
    \$\begingroup\$ Maybe you can stuff more stuff in if you rearrange so that it goes "questionairequipmentor" \$\endgroup\$ – Justin Jan 18 '14 at 18:01
  • \$\begingroup\$ Agree with Quincunx, addition to that is I believe one can have advantage of creating an algorithm in the generated code that takes advantage of the frequent use of the characters q u i e in the words worth most to create a 500 character output. But I am not sure \$\endgroup\$ – Plarsen Jan 18 '14 at 19:17
2
\$\begingroup\$

JavaScript & REBEL - 198

Initial program:

console.log( "nll(llf  r  e  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  a  g  e  r  u  n  u  b  i  q  u  i  t  o  u  s  e  q  u  i  p  m  e  n  t  o  r  e  q  u  i  v  a  l  e  n  t  r  i  u  m  p  h  e  q  u  i  l  i  b  r  i  u  m+.+ +.$0+;/ + +//.+/$>$0")+0 ;

Generated program:

nll(llf  r  e  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  a  g  e  r  u  n  u  b  i  q  u  i  t  o  u  s  e  q  u  i  p  m  e  n  t  o  r  e  q  u  i  v  a  l  e  n  t  r  i  u  m  p  h  e  q  u  i  l  i  b  r  i  u  m+.+ +.$0+;/ + +//.+/$>$0

Output:

nll(llfrequestionnairequipagerunubiquitousequipmentorequivalentriumphequilibrium+.+ +.$0+;

Notes:

Each word is output exactly once, except "me" which is output twice.

You will notice that the generated program is exactly 250 characters long. I didn't notice this until it was written. I consider myself lucky.

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

Python that outputs C, 947

##q##u##e##s##t##i##o##n##n##a##i##r##e##q##u##i##p##a##g##e##r##e##q##u##i##p##m##e##n##t##o##r##e##q##u##i##v##a##l##e##n##t##r##i##u##m##p##h##u##n##u##b##i##q##u##i##t##o##u##s##q##u##e##s##t##i##o##n##n##a##i##r##e##q##u##i##p##a##g##e##r##e##q##u##i##p##m##e##n##t##o##r##e##q##u##i##v##a##l##e##n##t##r##i##u##m##p##h##u##n##u##b##i##q##u##i##t##o##u##s##q##u##e##s##t##i##o##n##n##a##i##r##e##q##u##i##p##a##g##e##r##e##q##u##i##p##m##e##n##t##o##r##e##q##u##i##v##a##l##e##n##t##r##i##u##m##p##h##u##n##u##b##i##q##u##i##t##o##u##s##q##u##e##s##t##i##o##n##n##a##i##r##e##q##u##i##p##a##g##e##r##e##q##u##i##p##m##e##n##t##o##r##e##q##u##i##v##a##l##e##n##t##r##i##u##m##p##h##u##n##u##b##i##q##u##i##t##o##u##s##q##u##e##s##t##i##o##n##n##a##i##r##e##q##u##i##p##a##g##e##r##e##q##u##i##p##m##e##n##t##o##r##e##q##u##i##v##a##l##e##n##t##r##i##u##m##p##h##u##n##u##b##i##q##u##i##t##o##u##s##q##u##e##s##t##i##o##n##n##a##i##r##e##q##u##i##p##a##g##e##r##e##q##u##i##p##m##e##n##t##o##r##e##q##u##i##v##a##l##e##n##t##r##i##u##m##p##h##u##n##u##b##i##q##u##i##t##o##u##s##q##u##e##s##t##i##o##n##n##a##i##r##e##q##u##i##p##a##g##e##r##e##q##u##i##p##m##e##n##t##o##r##e##q##u##i##v##a##l##e##n##t##r##i##u##m##p##h##u##n##u##b##i##q##u##i##t##o##u##s
print 'main(i,j){for (i=0;i<7;i++) printf("questionnairequipagerequipmentorequivalentriumphunubiquitous");printf("a(jf =i;+pn(utniqpeqpnruanipniiu)rt\"a(jf =i;+pn(utniqpeqpnruanipniiu)rt\"j=+(nppuii)\\)");}'

I use the longest words (that give the best score) and overlapping words too (equipage-pager, as for the example). This is how the score is computed:

me= 2+1+0+0+0+0+0=3
ore= 3+2+1+0+0+0+0=6
pager= 7+6+5+4+3+2+1=28
mentor= 11+10+9+8+7+6+5=56
triumph= 13+12+11+10+9+8+7=70
equipage= 17+16+15+14+13+12+11=98
equipment= 19+18+17+16+15+14+13=112
equivalent= 23+22+21+20+19+18+17=140
unubiquitous= 31+30+29+28+27+26+25=196
questionnaire= 37+36+35+34+33+32+31=238

Total is 947.

Edit: now the generated program should output "exactly every third character from the original sourcecode" :)

\$\endgroup\$
  • \$\begingroup\$ Nice! Is your generated C-code actually printing exactly every third character of ALL your Python code? I also think you forgot counting your points for the words ore and me :) \$\endgroup\$ – Plarsen Jan 18 '14 at 19:51
  • \$\begingroup\$ I assumed that the generated code doesn't have to output ALL the Python code (maybe I misinterpreted the sentence "exactly every third character from the original sourcecode"). Will try to fix that. \$\endgroup\$ – Gabriele D'Antona Jan 18 '14 at 20:12
2
\$\begingroup\$

Javascript and Golfscript - 1074 points

Javascript (1500 chars):

/*e  q  u  i  l  i  b  r  i  u  m  u  n  u  b  i  q  u  i  t  o  u  s  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  a  g  e  r  e  q  u  i  l  i  b  r  i  u  m  u  n  u  b  i  q  u  i  t  o  u  s  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  m  e  n  t  o  r  e  q  u  i  l  i  b  r  i  u  m  u  n  u  b  i  q  u  i  t  o  u  s  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  a  g  e  r  e  q  u  i  l  i  b  r  i  u  m  u  n  u  b  i  q  u  i  t  o  u  s  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  m  e  n  t  o  r  e  q  u  i  l  i  b  r  i  u  m  u  n  u  b  i  q  u  i  t  o  u  s  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  a  g  e  r  e  q  u  i  l  i  b  r  i  u  m  u  n  u  b  i  q  u  i  t  o  u  s  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  m  e  n  t  o  r  e  q  u  i  l  i  b  r  i  u  m  u  n  u  b  i  q  u  i  t  o  u  s  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  a  g  e  r  e  q  u  i  l  i  b  r  i  u  m  u  n  u  b  i  q  u  i  t  o  u  s  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  m  e  n  t  o  r  e  q  u  i  l  i  b  r  i  u  m  u  n  u  b  i  q  u  i  t  o  u  s  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  a  g  e  r  e  q  u  i  l  i  b  r  i  u  m  u  n  u  b  i  q  u  i  t  o  u  s  q  u  e  s  t  i  o  n  n  a  i  r  e  q  u  i  p  m  e  n  t  o  r*/console.log(  "5{ 2{'equilibriumunubiquitousquestionnairequip'   'ager'}*   'mentor' \\;}*  'cseo 52eibuniiuutniqp ar* eo ; co2biui *o 2u*22  '" ); 

Generated Golfscript (128 chars): Test GolfScript online

5{ 2{'equilibriumunubiquitousquestionnairequip'   'ager'}*   'mentor' \;}*  'cseo 52eibuniiuutniqp ar* eo ; co2biui *o 2u*22  ' 

Output (500 chars):

equilibriumunubiquitousquestionnairequipagerequilibriumunubiquitousquestionnairequipmentorequilibriumunubiquitousquestionnairequipagerequilibriumunubiquitousquestionnairequipmentorequilibriumunubiquitousquestionnairequipagerequilibriumunubiquitousquestionnairequipmentorequilibriumunubiquitousquestionnairequipagerequilibriumunubiquitousquestionnairequipmentorequilibriumunubiquitousquestionnairequipagerequilibriumunubiquitousquestionnairequipmentorcseo 52eibuniiuutniqp ar* eo ; co2biui *o 2u*22  

Score:

10 * questionnaire (37+36+35+34+33+32+31+30+29+28)    = 325
10 * unubiquitous  (31+30+29+28+27+26+25+24+23+22)    = 265
10 * equilibrium   (29+28+27+26+25+24+23+22+21+20)    = 245
5  * equipage      (17+16+15+14+13)                   = 75
5  * pager         (7+6+5+4+3)                        = 25
5  * equipment     (19+18+17+16+15)                   = 85
5  * mentor        (11+10+9+8+7)                      = 45
4  * ore           (3+2+1)                            = 6
10 * me            (2+1)                              = 3

Total: 1074

UPDATE: Managed to gain some points by changing GolfScript loops from 3*3 to 5*2.

\$\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.