2
\$\begingroup\$

This challenge is about finding the perfect match between your program sourcecode and the output from your program.

Scoring table for the output:

   Each letters (a-z|A-Z) :   
        `a` or `A`   1 points
        `b` or `B`   2 points
                  ...
        `z` or `Z`  26 points

Scoring for the sourcecode:

   Each non-alphanumeric !(a-z|A-Z|0-9) :    
         3 points

Total score:

     Sourcecode-score * Output-score

Rules:

  1. Your program should take no input (from user, filename, network or anything).
  2. Sourcecode can be maximum 256 bytes|chars, Output can be maximum 384 bytes|chars
  3. Your programs output should include its own total score encapsulated within [], for example: [1024].
  4. No two neighbouring characters in output or sourcecode can be equal. That also impact the total score variation as it should be part of the output.
  5. Constraint, for each output character (=current char): The calculated sum of the char-distance to neighbour output char is called: char-dist. Non-alpha neighbours always adds 2 to char-dist. The output characters at char-dist pos before the current char cannot be equal to the current char. Calculating char-dist is not case sensitive, so the char-dist between A and F is: 5, and the char-dist between A and f is also: 5.

Clarification for rule 5 by example: If this 3 characters is part of the output: yZX then the char-dist for Z is (1+2)=3. That means 3 character pos before that Z there cannot be another Z or z in the output. Positions does not wrap around edges of the output.

Example non-valid output-part:

XYZYXW - here the calculated char-dist for the second Y from left is: (1+1)=2, and therefor the first Y from left cannot be two char pos before.

Example valid output-part:

XYZYWX - here the calculated char-dist for the second Y from left is: (1+2)=3 => the first Y from left is 2 positions away = valid.

Example valid answers:

I think I should sum this challenge up by giving some simple example valid answers:

Javascript (code: 34, output: 18) - Total score: (24*246)=5904

Sourcecode:    console.log("OPQRSTUVWXYZ[5904]");
Output:        OPQRSTUVWXYZ[5904]

Golfscript (code: 32, output: 32) - Total score: (39*491)=19149

Sourcecode:    '[19149]' 2{'NPQRSTUVWXYZ'}* 'A'
Output:        [19149]NPQRSTUVWXYZNPQRSTUVWXYZA

This is code-challenge, best total score wins! Good luck, have fun!

\$\endgroup\$
  • \$\begingroup\$ Do whitespaces count 3 towards my sourcecode scoring? \$\endgroup\$ – jazzpi Jan 19 '14 at 17:38
  • \$\begingroup\$ Yes, whitespace counts as non-alphanumeric => 3 points each \$\endgroup\$ – Plarsen Jan 19 '14 at 17:56
  • \$\begingroup\$ Rule 4 was meant to be case insensitive, for example: Zz or Aa is not allowed in sourecode or output \$\endgroup\$ – Plarsen Jan 20 '14 at 5:12
1
\$\begingroup\$

Brainfuck, 6789120

Sourcecode: 256 chars

+ + + + + + + + + + [
 > + + + + + + + + + + + + + + + + +
 > + + + + + + + + +
 > + + + + + + + + + + + +
 < < < -
]
> > > + + < < [
 > . > . < < -
]
< + + + + + + [ > + + + + + + + + + < - ]
> > + . <
. + . + . + . - - - - - - - - . + . - - .
> + + .
+-

Output: 350 chars ZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZzZz[6789120]

(char-dist is 0 and every character is 1 char apart)

It's late at night and I'm tired, probably will improve it tomorrow.

\$\endgroup\$
  • \$\begingroup\$ Nice workaround! Rule 4 actually was meant to be case insensitive, meaning Zz cannot be neighbours. \$\endgroup\$ – Plarsen Jan 20 '14 at 5:08
  • \$\begingroup\$ I will not change rule 4 this late, but your solution is violating rule 5: The output characters at char-dist pos before the current char cannot be equal to the current char. So in practise: a letter on output with char-dist 0 is not allowed. \$\endgroup\$ – Plarsen Jan 20 '14 at 5:44
  • \$\begingroup\$ @Plarsen From the question: "Example valid output-part: XYZYWX [...] the first Y from left is 2 positions away" If these two Y's are two positions away then I believe Zz is one position away; If X and Y have char-dist 1 then Z and z must have char-dist 0 \$\endgroup\$ – ace_HongKongIndependence Jan 20 '14 at 8:06
  • \$\begingroup\$ Yes, char-dist is 0 in middle Z in example zZz, according to rule 5 there cannot be a 'Z' in 0 position before a 'Z', so every char-dist of 0 is invalid. \$\endgroup\$ – Plarsen Jan 20 '14 at 11:29
  • \$\begingroup\$ There cannot be a 'Z' in 0 position before a 'Z'. Does my output has a 'Z' in 0 position before a 'Z'? No. Therefore, it is valid. \$\endgroup\$ – ace_HongKongIndependence Jan 20 '14 at 13:19

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.