3
\$\begingroup\$

Inspired by this challenge

Given a number m, output a program that prints out the string Do not repeat yourself.

Now for the challenging part: Each program the original code prints out has to have the byte at place m*n be the same as m*n + 1 and the same as m*n + 2 .... all the way down to m*n + m - 1.

(In case you can't tell, that means it has to be blocks of identical bytes m long)

Example (that only demonstrates the repetition rule, not the output):

2

aassdd

3

mmmyyy   nnnaaammmeee   iiisssfffrrreeeddd


27

111111111111111111111111111

##Scoring:

  • Your program's score is the x / (min(y, 10)^3), where y is the number of correct programs it outputs, and x is the sum of the lengths of all of the correct programs it outputs and y > 1. Lowest score wins.

##Other notes:

  • Your code doesn't have to fulfill any such restrictions on letters repeating.

  • Your programs (that you output) cannot take input of any sort.

  • The input will always be a positive integer greater than 1.

  • Your code needs to work for at least one integer greater than 1.

\$\endgroup\$
16
  • 1
    \$\begingroup\$ Would interface{static void main(String[]a){System.out.print("Do not repeat yourself");}} be considered acceptable. I am unsure of exactly what you are asking? \$\endgroup\$ Commented Jul 9, 2016 at 15:56
  • \$\begingroup\$ @RohanJhunjhunwala Your program needs to have blocks of characters of <input> length, e.g. for input 2 something like aabbccdd. \$\endgroup\$
    – Riker
    Commented Jul 9, 2016 at 15:58
  • 3
    \$\begingroup\$ Doesn't your challenge description disqualify most normal languages? \$\endgroup\$ Commented Jul 9, 2016 at 15:59
  • 1
    \$\begingroup\$ Why do we have to take input if we're printing a static string? \$\endgroup\$
    – DJMcMayhem
    Commented Jul 9, 2016 at 16:01
  • 1
    \$\begingroup\$ @Esterly Irk is this challenge possible to be done in java? I feel like its provably impossible \$\endgroup\$ Commented Jul 9, 2016 at 16:01

3 Answers 3

6
\$\begingroup\$

CJam, 3165 / 10³ = 3.165

{
"Do not repeat yourself"]sX/z_&
6)H7+G0+B8+H7+E8+G0+D8+9)C8+9)A7+E8+G0+B9+H7+K7+D8+J7+9)A8+I6+]{c}/
"Do not repeat yourself"]sZ/z_&

"Do not repeat yourself"]s3D&3D&3D&3D&3D&/z_&

"Do not repeat yourself"]s1F&1F&1F&1F&1F&1F&1F&/z_&



"Do not repeat yourself"]sB/z_&

"Do not repeat yourself"]sD/z_&

"Do not repeat yourself"]sF/z_&

"Do not repeat yourself"]sH/z_&

"Do not repeat yourself"]sJ/z_&
}`1>W<N/
e# Uncomment this line to count total length:
e# ee{~,*}%:+p [L]
ri\1$=f*

Works for inputs 1, 2, 3, 5, 7, 11, 13, 15, 17, 19.

Total length is 3165.

The program for input 2 is from here, credits to Super Chafouin.

Example: output for 11

"""""""""""DDDDDDDDDDDooooooooooo           nnnnnnnnnnnooooooooooottttttttttt           rrrrrrrrrrreeeeeeeeeeepppppppppppeeeeeeeeeeeaaaaaaaaaaattttttttttt           yyyyyyyyyyyooooooooooouuuuuuuuuuurrrrrrrrrrrssssssssssseeeeeeeeeeelllllllllllfffffffffff"""""""""""]]]]]]]]]]]sssssssssssBBBBBBBBBBB///////////zzzzzzzzzzz___________&&&&&&&&&&&

Explanation:

"""""""""""..."""""""""""    Push five empty strings, a long string,
                                and five more empty strings.
]]]]]]]]]]]sssssssssss       Collect them all in a list. Put that list in
                             10 more layers of list, for good measure.
                             Convert this to a string, to just get the long one.
BBBBBBBBBBB///////////       Split into chunks of size
                                11/(11/(.../(11/(11/11))))) = 11.
                             This gets us:
                                ["DDDDDDDDDDD" "ooooooooooo" ...]
zzzzzzzzzzz                  Transpose eleven times, i.e. once. We now have:
                                ["Do not..." "Do not..." ... "Do not..."]
___________&&&&&&&&&&&       Push eleven more copies, and get the unique elements.
                             This gets us:
                                ["Do not..."]
\$\endgroup\$
2
  • \$\begingroup\$ That is quite amazing! \$\endgroup\$ Commented Jul 9, 2016 at 16:08
  • \$\begingroup\$ You could add a special case for input 2 (main program size doesn't seem to matter). Also, I'm not sure if input 1 is counted. \$\endgroup\$ Commented Jul 9, 2016 at 16:15
4
\$\begingroup\$

Gammaplex, 2080 / 10³ = 2.08

X"Y#gmftsvp"2v
Ev2"!sfqfbu!z<
R>upo!pE#YYs"v
>1-swSs>swrsvS
?  v +=^?w-1<"
^ws<J0s11X"0F<

Note that it firstly displays a 0 when it is run. That's just the Gammaplex way of echoing the number you are going to input. And it prints the newline as , which shares the same code point with a newline in CP437.

Gammaplex renders the string in a window which couldn't be copied. So here is an equivalent CJam program to make testing easier:

"/
ERrXX\"Do not repeat yourself\"X"qie*

Example for m=3:

///


EEERRRrrrXXXXXX"""DDDooo   nnnooottt   rrreeepppeeeaaattt   yyyooouuurrrssseeelllfff"""XXX

In Gammaplex, only the position of the first newline is used to determine the line length. So it is the same as the following:

///
EEE
RRR
rrr
XXX
XXX
"""
DDD
ooo
   
nnn
ooo
ttt
   
rrr
eee
ppp
eee
aaa
ttt
   
yyy
ooo
uuu
rrr
sss
eee
lll
fff
"""
XXX

Then it works in the obvious way as a 2D language.

\$\endgroup\$
3
\$\begingroup\$

ferNANDo, 8745/103 = 8.745

7 - - - - D C B A
- - - - E D C B A

T D D
U E E
D T U
T B E
U C C
C T U
T B E
U B T
V E T
B U V

A A
I A A
I I
T I B
U I T
V T B
B U V
J I B
J J
T J C
U J T
V T C
C U V
I J C
I I
T I D
U I T
V T D
D U V

3
5 5
AD D D
AC C C
AB B B
AA A A
AD
AC
AB
AA
0 0 7 5 0 5 5 5
AA AA
AA
AB AB
AB
AC AC
AC
AD AD
AD
3 5
3
5 5

3
5 5
2 5 5
AH D D
AG C C
AF B B
AE A A
AH
AG
AF
AE
0 0 2 2 5 0 7 2
AE AE
AE
AF AF
AF
AG AG
AG
AH AH
AH
3 5
3
5 5

3
5 5
AL D D
AK C C
AJ B B
AI A A
AL
AK
AJ
AI
0 0 7 5 0 5 0 5
AI AI
AI
AJ AJ
AJ
AK AK
AK
AL AL
AL
3 5
3
5 5

3
4 3 3
AP D D
AO C C
AN B B
AM A A
AP
AO
AN
AM
0 0 3 2 4 2 4 0
AM AM
AM
AN AN
AN
AO AO
AO
AP AP
AP
2 2
3 2
3
2 2

3
5 5
AT D D
AS C C
AR B B
AQ A A
AT
AS
AR
AQ
0 0 7 5 0 0 5 5
AQ AQ
AQ
AR AR
AR
AS AS
AS
AT AT
AT
3 5
3
5 5

3
4 3 3
AX D D
AW C C
AV B B
AU A A
AX
AW
AV
AU
0 0 3 2 4 0 4 0
AU AU
AU
AV AV
AV
AW AW
AW
AX AX
AX
2 2
3 2
3
2 2

3
5 5
4 3 3
BB D D
BA C C
AZ B B
AY A A
BB
BA
AZ
AY
0 0 7 5 0 4 5 5
AY AY
AY
AZ AZ
AZ
BA BA
BA
BB BB
BB
3 5
3
5 5

3
BF D D
BE C C
BD B B
BC A A
BF
BE
BD
BC
0 0 7 2 0 0 2 2
BC BC
BC
BD BD
BD
BE BE
BE
BF BF
BF
2 2
3 2
3
2 2

3
5 5
4 3 3
BJ D D
BI C C
BH B B
BG A A
BJ
BI
BH
BG
0 0 7 5 0 1 0 4
BG BG
BG
BH BH
BH
BI BI
BI
BJ BJ
BJ
1 5 5
3 5
3
5 5

3
BN D D
BM C C
BL B B
BK A A
BN
BM
BL
BK
0 0 7 2 0 0 2 0
BK BK
BK
BL BL
BL
BM BM
BM
BN BN
BN
2 2
3 2
3
2 2

3
5 5
4 3 3
2 5 5
BR D D
BQ C C
BP B B
BO A A
BR
BQ
BP
BO
0 0 5 5 2 0 2 4
BO BO
BO
BP BP
BP
BQ BQ
BQ
BR BR
BR
3 5
3
5 5

3
BV D D
BU C C
BT B B
BS A A
BV
BU
BT
BS
0 0 7 2 0 2 2 2
BS BS
BS
BT BT
BT
BU BU
BU
BV BV
BV
2 2
3 2
3
2 2

3
5 5
4 3 3
BZ D D
BY C C
BX B B
BW A A
BZ
BY
BX
BW
0 0 7 5 0 4 4 4
BW BW
BW
BX BX
BX
BY BY
BY
BZ BZ
BZ
3 5
3
5 5

3
CD D D
CC C C
CB B B
CA A A
CD
CC
CB
CA
0 0 7 2 0 2 0 2
CA CA
CA
CB CB
CB
CC CC
CC
CD CD
CD
2 2
3 2
3
2 2

3
5 5
4 3 3
CH D D
CG C C
CF B B
CE A A
CH
CG
CF
CE
0 0 7 5 0 5 4 5
CE CE
CE
CF CF
CF
CG CG
CG
CH CH
CH
3 5
3
5 5

3
5 5
6 5
2 5 5
CL D D
CK C C
CJ B B
CI A A
CL
CK
CJ
CI
0 0 6 2 1 2 3 2
CI CI
CI
CJ CJ
CJ
CK CK
CK
CL CL
CL
1 5 5
3 5
3
5 5

3
5 5
CP D D
CO C C
CN B B
CM A A
CP
CO
CN
CM
0 0 7 5 0 0 1 1
CM CM
CM
CN CN
CN
CO CO
CO
CP CP
CP
1 5 5
3 5
3
5 5

3
CT D D
CS C C
CR B B
CQ A A
CT
CS
CR
CQ
0 0 7 2 0 2 2 2
CQ CQ
CQ
CR CR
CR
CS CS
CS
CT CT
CT
2 2
3 2
3
2 2

3
5 5
4 3 3
CX D D
CW C C
CV B B
CU A A
CX
CW
CV
CU
0 0 7 5 0 0 4 4
CU CU
CU
CV CV
CV
CW CW
CW
CX CX
CX
3 5
3
5 5

3
DB D D
DA C C
CZ B B
CY A A
DB
DA
CZ
CY
0 0 7 2 0 0 0 2
CY CY
CY
CZ CZ
CZ
DA DA
DA
DB DB
DB
2 2
3 2
3
2 2

3
5 5
DF D D
DE C C
DD B B
DC A A
DF
DE
DD
DC
0 0 7 5 0 0 0 1
DC DC
DC
DD DD
DD
DE DE
DE
DF DF
DF
1 5 5
3 5
3
5 5

3
5 5
6 5
4 3 3
2 5 5
DJ D D
DI C C
DH B B
DG A A
DJ
DI
DH
DG
0 0 3 2 4 0 6 2
DG DG
DG
DH DH
DH
DI DI
DI
DJ DJ
DJ
3 5
3
5 5

3
5 5
4 3 3
2 5 5
DN D D
DM C C
DL B B
DK A A
DN
DM
DL
DK
0 0 5 5 2 4 2 4
DK DK
DK
DL DL
DL
DM DM
DM
DN DN
DN
3 5
3
5 5

3
DR D D
DQ C C
DP B B
DO A A
DR
DQ
DP
DO
0 0 7 2 0 2 2 2
DO DO
DO
DP DP
DP
DQ DQ
DQ
DR DR
DR
2 2
3 2
3
2 2

3
5 5
4 3 3
DV D D
DU C C
DT B B
DS A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D
FI C C
FH B B
FG A A
FJ
FI
FH
FG
0 0 7 5 0 5 5 5
FG FG
FG
FH FH
FH
FI FI
FI
FJ FJ
FJ
3 5
3
5 5

3
FN D D
FM C C
FL B B
FK A A
FN
FM
FL
FK
0 0 7 2 0 0 2 2
FK FK
FK
FL FL
FL
FM FM
FM
FN FN
FN
2 2
3 2
3
2 2

3
5 5
FR D D
FQ C C
FP B B
FO A A
FR
FQ
FP
FO
0 0 7 5 0 1 1 1
FO FO
FO
FP FP
FP
FQ FQ
FQ
FR FR
FR
1 5 5
3 5
3
5 5

3
FV D D
FU C C
FT B B
FS A A
FV
FU
FT
FS
0 0 7 2 0 0 0 0
FS FS
FS
FT FT
FT
FU FU
FU
FV FV
FV
2 2
3 2
3
2 2

3
5 5
4 3 3
2 5 5
FZ D D
FY C C
FX B B
FW A A
FZ
FY
FX
FW
0 0 5 5 2 0 2 4
FW FW
FW
FX FX
FX
FY FY
FY
FZ FZ
FZ
3 5
3
5 5

3
GD D D
GC C C
GB B B
GA A A
GD
GC
GB
GA
0 0 7 2 0 0 0 2
GA GA
GA
GB GB
GB
GC GC
GC
GD GD
GD
2 2
3 2
3
2 2

3
5 5
4 3 3
GH D D
GG C C
GF B B
GE A A
GH
GG
GF
GE
0 0 7 5 0 4 4 4
GE GE
GE
GF GF
GF
GG GG
GG
GH GH
GH
3 5
3
5 5

3
GL D D
GK C C
GJ B B
GI A A
GL
GK
GJ
GI
0 0 7 2 0 0 0 2
GI GI
GI
GJ GJ
GJ
GK GK
GK
GL GL
GL
2 2
3 2
3
2 2

3
5 5
4 3 3
GP D D
GO C C
GN B B
GM A A
GP
GO
GN
GM
0 0 7 5 0 0 0 4
GM GM
GM
GN GN
GN
GO GO
GO
GP GP
GP
3 5
3
5 5

3
5 5
6 5
2 5 5
GT D D
GS C C
GR B B
GQ A A
GT
GS
GR
GQ
0 0 6 2 1 0 1 0
GQ GQ
GQ
GR GR
GR
GS GS
GS
GT GT
GT
1 5 5
3 5
3
5 5

3
5 5
GX D D
GW C C
GV B B
GU A A
GX
GW
GV
GU
0 0 7 5 0 1 0 5
GU GU
GU
GV GV
GV
GW GW
GW
GX GX
GX
1 5 5
3 5
3
5 5

3
5 5
6 5
2 5 5
HB D D
HA C C
GZ B B
GY A A
HB
HA
GZ
GY
0 0 6 2 1 2 1 2
GY GY
GY
GZ GZ
GZ
HA HA
HA
HB HB
HB
1 5 5
3 5
3
5 5

3
5 5
HF D D
HE C C
HD B B
HC A A
HF
HE
HD
HC
0 0 7 5 0 0 5 0
HC HC
HC
HD HD
HD
HE HE
HE
HF HF
HF
3 5
3
5 5

3
5 5
2 5 5
HJ D D
HI C C
HH B B
HG A A
HJ
HI
HH
HG
0 0 2 2 5 0 7 2
HG HG
HG
HH HH
HH
HI HI
HI
HJ HJ
HJ
3 5
3
5 5

3
5 5
HN D D
HM C C
HL B B
HK A A
HN
HM
HL
HK
0 0 7 5 0 1 1 1
HK HK
HK
HL HL
HL
HM HM
HM
HN HN
HN
1 5 5
3 5
3
5 5

3
HR D D
HQ C C
HP B B
HO A A
HR
HQ
HP
HO
0 0 7 2 0 2 2 2
HO HO
HO
HP HP
HP
HQ HQ
HQ
HR HR
HR
2 2
3 2
3
2 2

3
5 5
HV D D
HU C C
HT B B
HS A A
HV
HU
HT
HS
0 0 7 5 0 0 0 0
HS HS
HS
HT HT
HT
HU HU
HU
HV HV
HV
3 5
3
5 5

3
HZ D D
HY C C
HX B B
HW A A
HZ
HY
HX
HW
0 0 7 2 0 2 2 2
HW HW
HW
HX HX
HX
HY HY
HY
HZ HZ
HZ
2 2
3 2
3
2 2

3
5 5
4 3 3
ID D D
IC C C
IB B B
IA A A
ID
IC
IB
IA
0 0 7 5 0 4 4 4
IA IA
IA
IB IB
IB
IC IC
IC
ID ID
ID
3 5
3

Works for all inputs 1 through 15, 1 through 10 are counted in the score.

Update: reduced the size of the generator from ~16k down to 6.1k.


Sample output for m=3:

777   777


333


555   555


444   333   333


000   777   333   333   111   444   222   111


000   777   777   000   555   777   555   777


000   333   777   333   000   111   000   111


333   555


000   777   777   111   444   333   555   222


000   777   777   111   444   444   555   777


000   777   777   333   000   777   000   111


000   111   777   000   111   111   000   000


111   555   555


222   222


333


000   777   777   000   000   777   777   000
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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