3
\$\begingroup\$

General constraints:

  • Your program should not take any input.
  • Your program should output words, 1 word/line.
  • Only capital letters (A-Z) in the output.
  • A word must be atleast 2 letters in length.
  • A word can never be a palindrome. That is forbidden.

Rules for word-manipulations, one or more of these operations in any individual order for each new line:

  1. Change one or more letter(-s) in the word 1 char distance (example: A->B, F->E) from the previous word. 'A' can not be 'Z' and 'Z' can not be 'A'.
  2. Insert the letter "A" at any position.
  3. Remove any letter at any position.

Output validation:

Your program must output the following words: OUTPUT, YOUR, SOURCECODE, TODAY atleast (but not limited to) once each, in any order.

Sourcecode validation:

The first and the last letter of all output words should also be part of your sourcecode in the same order as scopes: first and last letter for the first word has the highest scope, example pseudo-code:

<any or no code><first letter, first word>
<any or no code><first letter, second word>
<any or no code><,...              ...,><any or no code>
<last letter, second word><any or no code>
<last letter, first word><any or no code>
  1. For any word # where the actual word number is a fibonacci-number, the first and last letters must be lower-case in the sourcecode.
  2. For any word # where the actual word number is not a fibonacci-number, the first and last letters must be upper-case in the sourcecode.

There is no restriction of the actual letters in the sourcecode, they can be inside strings or part of a command or anything, it is only the order that counts.

Example valid output (only the words YOUR and TODAY in the example):

YOUR
XOUAS
WOAAT
VOBAU
UOCAV
TODAW
TODAX
TODAY

Example valid sourcecode for the above output:

Since words 1, 2, 3, 5 and 8 in the example output is "fibonacci words", their first and last letter-representation in the sourcecode is lower case, leaving us with this constraint on the sourcecode:

yxwVuTTtyXWvUtsr

There could be any code around or between the letters in the sourcecode as long as the representation is there somewhere in that order.

This is code-golf, smallest sourcecode size in counted bytes wins. Competition ends: 2014-02-31.

\$\endgroup\$
7
  • 2
    \$\begingroup\$ This is super complicated. I'd be interested if anyone comes up with a sensible solution. \$\endgroup\$
    – Cruncher
    Jan 13, 2014 at 21:52
  • \$\begingroup\$ A working solution is easy, just figure out a valid sequence of words to output and put a string of the sourcecode constraint into the sourcecode. Golfing it migth be complicated though ;) \$\endgroup\$ Jan 13, 2014 at 21:57
  • \$\begingroup\$ What does "in any individual order" mean? \$\endgroup\$
    – Volatility
    Jan 13, 2014 at 22:21
  • \$\begingroup\$ You can apply the 3 operations on the word in any individual order. Example the "A" can be added and turned into "B" in the same "line" \$\endgroup\$ Jan 13, 2014 at 22:26
  • \$\begingroup\$ What is a "word number"? As in, "For any word # where the actual word number is a fibonacci-number…" \$\endgroup\$
    – DavidC
    Jan 13, 2014 at 22:53

7 Answers 7

2
\$\begingroup\$

Golfscript, 211 210

stuVwXYoOOOOoOOOOOOOoOOOOOOOUTTTTYXWVUTSRQPONmLKJIHGFeDCBB
{.2$<@@>{)}%+}:b;
'ROURCeCodeS'{95&}%
'()[]+\+); '7*';"OUSB" "A"+-3b "A"+'+'-3b '13*+'-2b '6*+';"UTOBUU" ;"TOCAV" ;"TODAW" '+'))[]++ '2*+
' '/{~n 1$}%-4<(@

Newlines added only for clarity, and can be removed. The last bits of the letter string are the name of the function and inside 'ROURCeCodeS'.

Test online

Output:

SOURCECODE
TOURCECOD
UOURCECO
VOURCEC
WOURCE
XOURC
YOUR
OUSB
OUTCB
OUTDCB
OUTEDC
OUTFED
OUTGFE
OUTHGF
OUTIHG
OUTJIH
OUTKJI
OUTLKJ
OUTMLK
OUTNML
OUTONM
OUTPON
OUTPPO
OUTPQP
OUTPRQ
OUTPSR
OUTPTS
OUTPUT
UTOBUU
TOCAV
TODAW
TODAX
TODAY
\$\endgroup\$
2
\$\begingroup\$

Java, 1091 1039 bytes

Probably not very good, but I'll give it a try. (Formatting worse will give less Bytes, but for now, let's leave it)

edit 1: used names for Vars to make comment shorter.

public class t {
public static void main(String[] V){
    StringBuilder w = new StringBuilder("SOURCECODE");
    X(w);
    for(int Y=0; Y<6; Y++){
        w.deleteCharAt(4);
        w.setCharAt(0,(char)(w.charAt(0)+1));
        X(w);
    }
    w.deleteCharAt(0);
    for(int o=0;o<2;o++){
        w.setCharAt(2,(char)(w.charAt(2)+1));
        w.append('A');
        w.append('A');
        X(w);}
    for(int O=0;O<20;O++){
        if (O<15) w.setCharAt(3,(char)(w.charAt(3)+1));
        w.setCharAt(4,(char)(w.charAt(4)+1));
        if (O<19) w.setCharAt(5,(char)(w.charAt(5)+1));
        X(w);}
    w.deleteCharAt(6);
    X(w);//o
    for(int O=0;O<6;O++){
        if (O<5) w.setCharAt(0,(char)(w.charAt(0)+1));
        w.setCharAt(1,(char)(w.charAt(1)-1));
        X(w);}
    for(int O=1;O<4;O++){
    w.deleteCharAt(2);//o
    if (O<3) w.insert(4, 'A');
    X(w);}
    for(int O=0;O<5;O++){
        if (O<3) w.setCharAt(2,(char)(w.charAt(2)+1));
        w.setCharAt(4,(char)(w.charAt(4)+1));
        X(w);}
    //OOOOPQRsTTTTTTTTTT
    //yxwVuTTtTTTTtTTAAAAAaAAAAAAAAAAAAaAAREEEEEEE
}
static void X(StringBuilder b){System.out.println(b.toString());}}

outputs:

SOURCECODE
TOURECODE
UOURCODE
VOURODE
WOURDE
XOURE
YOUR
OUSAA
OUTAAAA
OUTBBBA
OUTCCCA
OUTDDDA
OUTEEEA
OUTFFFA
OUTGGGA
OUTHHHA
OUTIIIA
OUTJJJA
OUTKKKA
OUTLLLA
OUTMMMA
OUTNNNA
OUTOOOA
OUTPPPA
OUTPQQA
OUTPRRA
OUTPSSA
OUTPTTA
OUTPUTA
OUTPUT
PTTPUT
QSTPUT
RRTPUT
SQTPUT
TPTPUT
TOTPUT
TOPUAT
TOUAAT
TOAAT
TOBAU
TOCAV
TODAW
TODAX
TODAY
\$\endgroup\$
0
2
\$\begingroup\$

Mathematica 226 221 217

A little bit longer than GolfScript:

yxwV;
u:O_~T~OO_:=T[Print@FromCharacterCode@Select[O,#>64&]TSRQp;O+Sign[OO-O],u=OO]
"YOUR"
oOOOOOOOOOPQRsSSSEEDcBA(TT=ToCharacterCode)@"XOA@@S"~T~TT@"TODA@Y"~T~TT@"OUTPUT"t;
TT@"PTUQA?=T>@"~T~TT@"SOURCECODE"uVWXYyXWvUtsr;

Output:

YOUR
XOAS
WOBAT
VOCAU
UODAV
TODAW
TODAX
TODAY
TODAY
SPEBAX
RQFCBW
QRGDCV
PSHEDU
OTIFET
OUJGFT
OUKHGT
OULIHT
OUMJIT
OUNKJT
OUOLKT
OUPMLT
OUQNMT
OURONT
OUSPOT
OUTPPT
OUTPQT
OUTPRT
OUTPST
OUTPTT
OUTPUT
PTUQAT
QSURBSA
RRURCARB
SQURCBQAC
SPURCCAPBD
SOURCDBOCE
SOURCECODE

ClearAll[T] is necessary after usage.

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

Windows Batch File, 557

::yxwVuTTtSRQPoOOOOOOOoOOOOOOOOPQRSsSSSS
::EDCBaATTTTTTTTTTTtTTTTTTTtUVXXyXWvUtsr
echo YOUR
echo XOUAS
echo WOAAT
echo VOBAU
echo UOCAV
echo TODAW
echo TODAX
echo TODAY
echo SPEBAX
echo RQFCBX
echo QRGDCV
echo PSHEDU
echo OTIFET
echo OUJGFT
echo OUKHGT
echo OULIHT
echo OUMJIT
echo OUNKJT
echo OUOLKT
echo OUPMLT
echo OUQNMT
echo OURONT
echo OUSPOT
echo OUTPPT
echo OUTPQT
echo OUTPRT
echo OUTPST
echo OUTPTT
echo OUTPUT
echo PTUQAUT
echo QSURBAUT
echo RRURCBAUT
echo SQURCCBTA
echo SPURCDCSBA
echo SOURCECRCB
echo SOURCECQDC
echo SOURCECPDD
echo SOURCECODE
\$\endgroup\$
2
  • \$\begingroup\$ With similar code on Unix you could save a bunch of characters with tr , "\n"<<<'YOUR,XOUAS,...,SOURCECODE'|cat. \$\endgroup\$
    – wchargin
    Jan 14, 2014 at 3:41
  • \$\begingroup\$ @WChargin Windows does it the long way. \$\endgroup\$
    – Timtech
    Jan 14, 2014 at 11:51
1
\$\begingroup\$

GTB, 403

]yxwVuTTtSRQPoOOOOOOOoOOOOOOOOPQRSsSSSS\EDCBaATTTTTTTTTTTtTTTTTTTtUVXXyXWvUtsr[~"YOUR~"XOUAS~"WOAAT~"VOBAU~"UOCAV~"TODAW~"TODAX~"TODAY~"SPEBAX~"RQFCBX~"QRGDCV~"PSHEDU~"OTIFET~"OUJGFT~"OUKHGT~"OULIHT~"OUMJIT~"OUNKJT~"OUOLKT~"OUPMLT~"OUQNMT~"OURONT~"OUSPOT~"OUTPPT~"OUTPQT~"OUTPRT~"OUTPST~"OUTPTT~"OUTPUT~"PTUQAUT~"QSURBAUT~"RRURCBAUT~"SQURCCBTA~"SPURCDCSBA~"SOURCECRCB~"SOURCECQDC~"SOURCECPDD~"SOURCECODE
\$\endgroup\$
0
\$\begingroup\$

[C/C++] 1239 chars

Concept solution.

main() {
    // yxwVuTTtSRQPoOOOOOOOoOOOOOOOOPQRSsSSSS
    // EDCBaATTTTTTTTTTTtTTTTTTTtUVXXyXWvUtsr

    printf("YOUR\n");
    printf("XOUAS\n");
    printf("WOAAT\n");
    printf("VOBAU\n");
    printf("UOCAV\n");
    printf("TODAW\n");
    printf("TODAX\n");
    printf("TODAY\n");
    printf("SPEBAX\n");
    printf("RQFCBX\n");
    printf("QRGDCV\n");
    printf("PSHEDU\n");
    printf("OTIFET\n");
    printf("OUJGFT\n");
    printf("OUKHGT\n");
    printf("OULIHT\n");
    printf("OUMJIT\n");
    printf("OUNKJT\n");
    printf("OUOLKT\n");
    printf("OUPMLT\n");
    printf("OUQNMT\n");
    printf("OURONT\n");
    printf("OUSPOT\n");
    printf("OUTPPT\n");
    printf("OUTPQT\n");
    printf("OUTPRT\n");
    printf("OUTPST\n");
    printf("OUTPTT\n");
    printf("OUTPUT\n");
    printf("PTUQAUT\n");
    printf("QSURBAUT\n");
    printf("RRURCBAUT\n");
    printf("SQURCCBTA\n");
    printf("SPURCDCSBA\n");
    printf("SOURCECRCB\n");
    printf("SOURCECQDC\n");
    printf("SOURCECPDD\n");
    printf("SOURCECODE\n");
}
\$\endgroup\$
0
\$\begingroup\$

PHP: 321316 bytes

I can't take much credit for this; all I did was compress and base64 encode the word sequence in Timtech's answer.

<?php //yxwVuTTtSRQPoOOOOOOOoOOOOOOOOPQRSsSSSSEDCBaATTTTTTTTTTTtTTTTTTTtUVXXyXWvUtsr
echo gzinflate(base64_decode("Nc5JDsAgCEDRPbdStHMLInS4/0UqNd3wvokJPGQCN1mocFEICifFYGCE4QSlFK5v3t98oHKO7SFlwHhDkTHhCVynnAxI5yErkC3j4KzT6Gzz5OzL7Bzr4tC2OrxvTjl2R+hwKpOjzJ3SkU7taMcUWK2EZqkm0UPEBL+qpRVGDe3uVglrbNkWYcb25c+S8E9O6U9K+QU="));?>

Edit: Moving the comment to the end allows a few characters to be shaved off:

<?php echo gzinflate(base64_decode("Nc5JDsAgCEDRPbdStHMLInS4/0UqNd3wvokJPGQCN1mocFEICifFYGCE4QSlFK5v3t98oHKO7SFlwHhDkTHhCVynnAxI5yErkC3j4KzT6Gzz5OzL7Bzr4tC2OrxvTjl2R+hwKpOjzJ3SkU7taMcUWK2EZqkm0UPEBL+qpRVGDe3uVglrbNkWYcb25c+S8E9O6U9K+QU="));//TTtSRQPoOOOOOOOoOOOOOOOOPQRSsSSSSEDCBaATTTTTTTTTTTtTTTTTTTtUVXXyXWvUtsr
?>
\$\endgroup\$
1
  • \$\begingroup\$ Thanks for giving credit... I know it's not likely to win anything :) \$\endgroup\$
    – Timtech
    Jan 14, 2014 at 0:53

Your Answer

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

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