Golf some ones, and a program too

-2

Introduction

Busy Beavers are programs (specifically Turing Machine programs) that aim to output the most ones as possible, while having the least states as possible and halting.


Challenge

Your challenge is to make a busy beaver, which outputs as many ones as possible, but also outputs a second busy beaver. That second busy beaver must be executable in the same language as the original program, and can be no more bytes than the program that produced it

So, for example, say my program was a. That program should aim to print as many 1s as possible, and also output another program, say b, which also aims to print as many 1s as possible and outputs another program etc etc etc. b must be no more bytes than a

The program should be printed after the 1s, separated by any reasonable delimiter.

The outputted programs must also not be the same as any of the previous programs. When no more programs are generated, the scores are calculated from there. For example, program a can print b can print c can print d, but d doesn't print any other program. The scores would be calculated as (a_ones + b_ones + c_ones + d_ones) / (a_bytes + b_bytes + c_bytes + d_bytes) (see below)

The programs must also never error. The "programs" can also be functions, as long as they execute with no arguments


Scoring

Your submission's score is the sum of the number of ones outputted by your programs, all divided by the sum of the bytes of the programs. The higher the score, the better.

FireCubez

Posted 2018-11-15T19:59:02.050

Reputation: 857

Question was closed 2018-11-16T05:13:57.947

Is f=_=>1 and f=_=>2 different programs? – Luis felipe De jesus Munoz – 2018-11-15T20:10:11.363

3At some point down the rabbit hole, the programs will no longer be able to output new programs different from but no bigger than the previous ones, by the pigeonhole principle. So not all of your requirements can be satisfied at once! – Misha Lavrov – 2018-11-15T20:11:49.813

@LuisfelipeDejesusMunoz Yes – FireCubez – 2018-11-15T20:33:45.637

@MishaLavrov Oh, forgot to mention that if you can't print anything anymore, the chain stops there and the scores are added – FireCubez – 2018-11-15T20:34:53.123

4With the current rules, it seems likely that the way to maximize the score is to just print lots of ones, without printing a second program. – Misha Lavrov – 2018-11-15T20:47:21.237

@MishaLavrov How is that? One would get a much better score by simply, for example, printing lots of ones, and including a second, smaller program which would probably double the ones count – FireCubez – 2018-11-15T20:49:14.360

If the second program prints a similar number of ones, it's probably the same size as the first program. You're dividing by the total size of the programs, so the number you're dividing by also doubles. And there's overhead in printing another program that's not going to printing more ones. – Misha Lavrov – 2018-11-15T20:50:44.890

@MishaLavrov repeat 9999**99999999999: print 1; repeat 99: print ",repeat 9999**99999999999: print 1;"; – FireCubez – 2018-11-15T20:53:58.500

Your second program is now much longer than the first program. – Misha Lavrov – 2018-11-15T20:54:53.633

Let us continue this discussion in chat.

– FireCubez – 2018-11-15T20:55:35.350

@JoKing "The outputted programs must also not be the same as any of the previous programs." – FireCubez – 2018-11-15T22:38:31.043

3There should probably be a restriction on how long a program could be, since the effect of dividing by the bytecount will be negligible for better busy beavers – Jo King – 2018-11-15T22:46:42.727

scoring bad fot 1-len-chain usually better? – l4m2 – 2018-11-18T12:48:45.890

Answers

1

C (gcc), 71 bytes

I've not done one of these before but here's a shot at it;

Each program should print 4,294,967,295 ones, divided by the sum of bytes 71+30 scores 85,048,857

main(c){puts("main(c){while(~c++)puts(\"1\");}");for(;~c++;)puts("1");}

Try it online!

cleblanc

Posted 2018-11-15T19:59:02.050

Reputation: 3 360

How many 1s is this supposed to print? – FireCubez – 2018-11-15T20:35:02.570

1

JavaScript (Node.js), 50 bytes

(f=_=>_?'1'.repeat(_)+`&&(f=${f})(${_-1})`:1)(1e3)

Try it online!

Luis felipe De jesus Munoz

Posted 2018-11-15T19:59:02.050

Reputation: 9 639

It seems like you want something more like (f=_=>[...Array(_)].map(a=>1).join\`+`\n(f=${f})(${_-1})`)(1e3)`; otherwise, the output after all the 1s doesn't look like a working program to me. Also, I'm not sure where the factorial in your score is coming from. – Misha Lavrov – 2018-11-15T20:31:03.047

1000! would be approximately 4.023872600770938*10^2567. None of your programs output that many ones. – Misha Lavrov – 2018-11-15T20:33:41.120

Using && will evaluate the previous numbers as true and will excecute the next line of code that is going to be the same program but with a different number (IDK if this fits into the rules since is not the same program at all) – Luis felipe De jesus Munoz – 2018-11-15T20:34:20.763

Lol @MishaLavrov my bad, I'm pretty bad at math Dx – Luis felipe De jesus Munoz – 2018-11-15T20:35:34.000

1Changing 1e3 to 1e9 will give you a lot more 1s! – Shaggy – 2018-11-15T20:35:56.677

@LuisfelipeDejesusMunoz The program printed by your program errors on TIO – FireCubez – 2018-11-15T20:38:56.737

It can't refer to itself, as it seems to be – FireCubez – 2018-11-15T20:40:23.840

@FireCubez It was because of Shaggys , xD let me rollback – Luis felipe De jesus Munoz – 2018-11-15T20:41:08.453

@Shaggy Running the output will cause an error – Luis felipe De jesus Munoz – 2018-11-15T20:44:01.690

@FireCubez Check again, but I think this shouldnt be a valid answer since it just calls itself with different parameters. The score of answers like this will be Infinite – Luis felipe De jesus Munoz – 2018-11-15T20:44:42.733

The bigger the initial input (in this case is just 1000), the bigger the score – Luis felipe De jesus Munoz – 2018-11-15T20:45:30.850

In fact, this errors when given a parameter of -1, so it isn't valid. I should've made that more clear. – FireCubez – 2018-11-15T20:47:14.497

1e9 will run on TIO now, but exceed its output limits. – Shaggy – 2018-11-15T21:21:39.503

1

brainfuck, 99 bytes, \$f_{255}(255^2)\$

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

Assumes a wrapping implementation with an infinite tape in both directions.

This is modified from my Largest Number Printable to print 1s instead of 3s.

Jo King

Posted 2018-11-15T19:59:02.050

Reputation: 38 234