15
\$\begingroup\$

Edit: Allowed to reuse whitespaces.

Your task is to write n programs (or functions, or bodies of functions without using parameters or the function names) in the same language. The kth program should output the (cardinal) number k in standard English in lowercase (with an optional trailing newline). So the first program should output one, the second should output two, etc. For a number having two parts, they should be separated by a hyphen like twenty-one.

But no two programs in your submission can share non-whitespace characters or whitespace characters doing useful works. For example, if your first program is just "one", then none of " o n and e can be used again in your other programs.

You can use whitespace characters (spaces, newlines and tabs) in two or more programs, if they only serve as separators or indentation and don't do anything by themselves. So you can't reuse them in the Whitespace language, and you can't use them in strings in more than one program.

You can only use printable ASCII characters, tabs, and newlines (including CR and LF). Every program must contain at least 1 character.

Your score is the sum of 1/program size^1.5. Highest score wins. You can use this Stack Snippet (or this CJam code) to calculate your score:

function updatescore(a){var l=a.value.split("\n"),s=0;for(var i=0;i<l.length;i++){var t=l[i].length;t-=t&&l[i][t-1]=="\r";if(t)s+=Math.pow(t,-1.5);}document.getElementById('result').textContent=s;}
<textarea id="input" placeholder="Put your code here, one per line." style="width:100%;height:150px;box-sizing:border-box" oninput="updatescore(this)" onpropertychange="updatescore(this)"></textarea><div>Your score: <span id="result">0</span></div>

\$\endgroup\$
  • \$\begingroup\$ One better scoring rule may be the sum of 1/(program size+c)^1.5, where c is a constant. But I think it's probably too late to change it. \$\endgroup\$ – jimmy23013 May 21 '15 at 21:27
  • \$\begingroup\$ Can we add a multiplier for getting to a higher cardinal number, since that seems to be the goal? I got to twelve, higher than all the others, but still am losing. \$\endgroup\$ – mbomb007 May 21 '15 at 23:37
  • \$\begingroup\$ @mbomb007 Sorry for deliberately making Headsecks a lower score. But if Headsecks has just similar score to others, I guess Glypho will win too much (not to say Lenguage). \$\endgroup\$ – jimmy23013 May 22 '15 at 5:05
  • \$\begingroup\$ I want to do this in whitespace :( \$\endgroup\$ – YoYoYonnY May 24 '15 at 15:51
  • 1
    \$\begingroup\$ @mbomb007 If I'm asking a similar question again I'll probably add a small constant to the program sizes in the score. But it's too arbitrary to change in this question. \$\endgroup\$ – jimmy23013 Jun 8 '18 at 15:06
6
\$\begingroup\$

gs2, 0.38669200758867045

Remove whitespace from all of these programs but three, it's only for (coughs) readability. one and six are gs2 programs that crash (by underflowing the stack), which conveniently makes them quines.

one (3 bytes)

one

two (1384 bytes)

A?"A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0
A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0
A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0
A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0
A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0
A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0000000000000
000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000A?"A"0A"0A"0A"0A
"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A
"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A
"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A
"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A
"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A
"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"00000000000000000000
000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000A?"A"0A"0A"0A"0A"0A"
0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"
0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"
0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"
0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"
0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"0A"
0A"0A"0A"0A"000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
0000

three (92 bytes)

0a 21 2c 21 20 21 20 21 20 21 20 21 20 21 20 21
20 21 20 21 20 21 20 21 20 21 20 21 20 21 20 21
20 21 20 2f 20 0a 21 28 3c 0a 21 2c 21 20 21 20
21 20 21 20 2f 20 0a 21 28 3c 45 21 20 21 20 21
2f 20 0a 21 28 3c 0a 21 2c 21 20 2f 20 0a 21 28
3c 0a 21 2c 21 20 2f 20 0a 21 28 3c

Lots of significant whitespace so here's a hex dump. It has a single line feed character at the start:


!,! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! / 
!(<
!,! ! ! ! / 
!(<E! ! !/ 
!(<
!,! / 
!(<
!,! / 
!(<

four (276 bytes)

f$f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$
31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$
31Mf$f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f$f$31f
$f$31f$f$31Mf$f$f$31f$f$31f$f$31f$f$31f$f$31Mf$f$f$31f$f$31f
$f$31f$f$31f$f$31f$f$31f$f$31f$f$31M

five (178 bytes)

hd+++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Khd+++&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&Khd+++&&&&&&&&&&&&&&&&&&&&
&&&&&&&Khd+++&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&K

six (3 bytes)

six
\$\endgroup\$
  • \$\begingroup\$ I didn't see that requirement -- I'll go through and fix the intermediate solutions. \$\endgroup\$ – Lynn May 21 '15 at 16:15
  • \$\begingroup\$ I get to use 20 through 7E, 09 (tab), 0A (LF), and 0D (CR), right? \$\endgroup\$ – Lynn May 21 '15 at 16:19
  • \$\begingroup\$ Yes. Edited to allow CR explicitly. \$\endgroup\$ – jimmy23013 May 21 '15 at 16:25
  • \$\begingroup\$ The 1 in five was a typo; I've gone and removed it. I'll fix three now. \$\endgroup\$ – Lynn May 21 '15 at 20:38
  • 2
    \$\begingroup\$ Programs one and six are essentially syntax errors that dump the source code to STDOUT and show an error on STDERR. Consensus seems to be that this is OK (so kudos) but you should mention it in your answer. \$\endgroup\$ – Dennis May 21 '15 at 21:57
13
\$\begingroup\$

CJam, 0.24075

Programs

BA1]100cf|
"two"
{hree}`W<7a.-
N)92+_9+_6+_2~+
S(84^I^U$F^X$G^Y$(
's'i'x

Thanks to @user23013 for his suggestion to use ' for six.

Output, length, score, used characters

one    10  0.03162          01       AB         ]    c f         |  
two     5  0.08944  "                                     o  tw     
three  13  0.02133        -.     7  <        W     `a e h  r    { } 
four   15  0.01721      )+    2 6  9      N       _                ~
five   18  0.01309   $ (       4  8    FGI SU XY ^                  
six     6  0.06804    '                                  i  s  x

Verify the results yourself in the CJam interpreter.

\$\endgroup\$
6
\$\begingroup\$

Insomnia, 0.100688383057110116

Just to get things started. It's very unlikely that this is going to win. Under the current scoring scheme, any language that can print one in 5 or less characters has overwhelming advantage.

one (8 bytes, 0.04419417382415922)

uuyp>~p~

two (9 bytes, 0.037037037037037035)

oeoojdoLj

three (21 bytes, 0.010391328106475828)

*FFFFF
=
=z"
n=nnFzzB

four (23 bytes, 0.009065844089438033)

)HGGGkGGGtGkGk<GGh$HGGt
\$\endgroup\$
4
\$\begingroup\$

Headsecks, 0.044623631135793776

Generated here

This language is a simple BF substitution where the only thing that matters is the character value modulo 8.

Unfortunately, longer programs give a worse score, despite being able to get to twelve! (I could get higher if I could use non-printable ASCII, and Unicode.)

one

##%%%%%%%&##$%&#&%&%%%%%%%%%&

two

--------+--.+++,-..+++.--------.

three

5555555535563334566555555555555633333333336555555555555566

four

==;=====>;<=>>;;;;;;;;;>;;;;;;>===>

five

EECEEEEEFCDEFFCCCFCEFCCCCCCDEFFCCEFCCCDEFF

six

KKMMMMMMMMMNKKLMNKNMMMMMMMMMMNMKMMMNKLMNN

seven

SSUUUUUUUUUVSSTUVSVSSSSSUVSSSTUVVSUUUVSTUVUVSSUVSSSTUVVSSSSSSSSSV

eight

]][]]]]]^[\]^]^[[[[^]]^[^[[[[[[[[[[[[^

nine

cceeeeeeefccdeffeeeeefcccccfeeeeeeeeef

ten

mmmmmmmmkmmnkkklmnnkkkkmnkkklmnnkkkkkkkkkn

eleven

uusuuuuuvstuvuvsssssssvuuuuuuuvsuuuvstuvuvssuvssstuvvsssssssssv

twelve

}}}}}}}}{}}~{{{|}~~{{{~{}~{{{|}~~{{{{{{{~{{{{{{{{{{~{{}~{{{|}~~
\$\endgroup\$
  • \$\begingroup\$ You can only use printable ASCII characters, tabs, and newlines. \$\endgroup\$ – jimmy23013 May 21 '15 at 22:13
  • \$\begingroup\$ @user23013 I did as many as I could, and I got to 12. \$\endgroup\$ – mbomb007 May 21 '15 at 23:37
2
\$\begingroup\$

///, 0.19245008972987526

one

This answer is inspired by @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳'s answer, in which he said

Under the current scoring scheme, any language that can print one in 5 or less characters has overwhelming advantage.

\$\endgroup\$
  • \$\begingroup\$ OK, the scoring algorithm seems to have a loophole. Well played. \$\endgroup\$ – Dennis May 21 '15 at 13:55
  • \$\begingroup\$ Well, this question is sandboxed so long just to get a better scoring method. And it still didn't work well... This also works in PHP, ASP, etc. \$\endgroup\$ – jimmy23013 May 21 '15 at 14:06
0
\$\begingroup\$

SmileBASIC, .10062

"one"

?"one

"two"

PRINT MID$(@two,1,3)

My other answer is more interesting, but this one gets a higher score.

An important strategy to get the longest chain is to use MORE characters to save on UNIQUE characters (for example, using x - -x in program 2 to save y + y for program 3)

The problem with the scoring system is that it scores 2 short programs better than 3 long programs, so there is no reason to save characters for later programs if it makes the current program longer.

Also, it values individual short programs higher than a smaller TOTAL size. If I swap ? and PRINT in my answer I can save 1 character, but my score is HALF as much.

I think it would've been better to base it only on number of programs, with total size as a tiebreaker.

\$\endgroup\$
  • 3
    \$\begingroup\$ I think both programs are sharing an o... \$\endgroup\$ – JayCe Jun 7 '18 at 23:33

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.