Print strings without sharing characters

15

2

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>

jimmy23013

Posted 2015-05-21T01:15:03.350

Reputation: 34 042

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. – jimmy23013 – 2015-05-21T21:27:37.027

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. – mbomb007 – 2015-05-21T23:37:39.357

@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). – jimmy23013 – 2015-05-22T05:05:46.450

I want to do this in whitespace :( – YoYoYonnY – 2015-05-24T15:51:08.210

@YoYoYonnY You can but it is likely that Whitespace can only print one... – jimmy23013 – 2015-05-24T16:05:04.517

@jimmy23013 A better scoring rule would be to count by number of programs, then by fewest total bytes. I think you could still change it, as it would encourage new answers. – mbomb007 – 2018-06-08T14:02:22.993

@mbomb007 It was intended to discourage Lenguage and Headsecks. While possibly it's not much to change the scoring, I'll probably disqualify at least one answer if I come up with other ways to discourage them. So better not. – jimmy23013 – 2018-06-08T15:04:44.530

1@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. – jimmy23013 – 2018-06-08T15:06:48.383

Answers

6

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

Lynn

Posted 2015-05-21T01:15:03.350

Reputation: 55 648

I didn't see that requirement -- I'll go through and fix the intermediate solutions. – Lynn – 2015-05-21T16:15:40.710

I get to use 20 through 7E, 09 (tab), 0A (LF), and 0D (CR), right? – Lynn – 2015-05-21T16:19:23.960

Yes. Edited to allow CR explicitly. – jimmy23013 – 2015-05-21T16:25:56.100

The 1 in five was a typo; I've gone and removed it. I'll fix three now. – Lynn – 2015-05-21T20:38:58.570

2

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.

– Dennis – 2015-05-21T21:57:35.877

13

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.

Dennis

Posted 2015-05-21T01:15:03.350

Reputation: 196 637

6

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

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2015-05-21T01:15:03.350

Reputation: 5 683

4

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

}}}}}}}}{}}~{{{|}~~{{{~{}~{{{|}~~{{{{{{{~{{{{{{{{{{~{{}~{{{|}~~

mbomb007

Posted 2015-05-21T01:15:03.350

Reputation: 21 944

You can only use printable ASCII characters, tabs, and newlines. – jimmy23013 – 2015-05-21T22:13:47.873

@user23013 I did as many as I could, and I got to 12. – mbomb007 – 2015-05-21T23:37:02.260

2

///, 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.

user12205

Posted 2015-05-21T01:15:03.350

Reputation: 8 752

OK, the scoring algorithm seems to have a loophole. Well played. – Dennis – 2015-05-21T13:55:56.280

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. – jimmy23013 – 2015-05-21T14:06:33.390

0

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.

12Me21

Posted 2015-05-21T01:15:03.350

Reputation: 6 110

3I think both programs are sharing an o... – JayCe – 2018-06-07T23:33:21.787