11
1
What is the best BrainFuck code (in terms of code size) to print 'A' 1000 times ?
My approach is:
- set 'A' to p[0]
- set 255 to p[1] to display 255 'A', 3 times
- set 235 to p[1] to display 235 'A'
This is not effective but I cannot find a way to use tow counters simultaneously like a multiplication
Is there a better approach than a multiplication ?
A more general question: is there a rule to make a multiplication with a large number with the smallest possible code?
4This is a good place to start. Welcome to Code golf! :) – FryAmTheEggman – 2019-06-16T21:02:08.413
3
I think you want to just use a nested loop, but I don't know BF very well. Have you seen Brainfuck tips? Also probably the esolangs page on Brainfuck constants would be a useful resource here.
– Jonathan Allan – 2019-06-16T21:02:49.1574I think you should clarify best BrainFuck code. Are you in search of most readable, most elegant, using the least amount of
+
characters or simply highest brevity? – Jonathan Frech – 2019-06-16T22:17:51.750@Jonathan Allan: Yes, that's the purpose of this question : How to use a nested loop. It's a fascinating language close ASM but I don't understand some aspects – Nelson G. – 2019-06-17T06:31:22.703
Could I use this variant on BF -> https://github.com/gergoerdi/brainfuck64
– Shaun Bebbers – 2019-06-17T10:50:11.533Question author had edited the question to clarify best means smallest code size. It about asking golf tips for a clear defined task with some certain language. I would consider it clear and on topic. So this question should be reopen imo. – tsh – 2019-06-19T07:12:04.833
It is tagged code-golf. It's pretty clear and this is on-topic. – mbomb007 – 2019-06-19T15:12:07.257
There is still some confusion on my part. Is the OP looking for the shortest code to generate 1000? Or, given any arbitrary
n
, generate the shortest BF code to produce it? – Giuseppe – 2019-06-19T17:35:19.410