Print 'A' 1000 times with BrainFuckTips for golfing in brainfuckHow to shorten this J code? (Or write shorter code in another language)BrainF***-optimize a series of numbersVerify Brainfuck programImplement multiplication by a constant with addition and bit shiftsBrainf*** subprograms with unique outputsConvert Brainfuck to a Non-Golfing LanguageConvert Brainfuck to MarioLANGBetter way to read multiple int in C than scanfHow can I shorten this multiple assignment in Lua?Brainf*ck Loop Problem
Unrecognized IC Package Style
Is there a term for the belief that "if it's legal, it's moral"?
Would a 7805 5 V regulator drain a 9 V battery?
In the US, can a former president run again?
Why things float in space, though there is always gravity of our star is present
Why is it easier to balance a non-moving bike standing up than sitting down?
Definition of 'vrit'
Is Newton's third law really correct?
Unable to import binding 'SforceServiceBinding' with the Summer 19 Tooling API WSDL
Why is Havana covered in 5-digit numbers in Our Man in Havana?
What is that ceiling compartment of a Boeing 737?
Why are there no file insertion syscalls
I found a password with hashcat but it doesn't work
How to best clean this sealed rotary encoder / volume knob?
How to take photos with a yellowish tone and point-and-shoot film camera look?
Counterfeit checks were created for my account. How does this type of fraud work?
Why isn't my calculation that we should be able to see the sun well beyond the observable universe valid?
Predict the product from the reaction
Is there any possible way to get these hearts as Adult Link?
The Amazing Sliding Crossword
Why there is a red color in right side?
Why is it 出差去 and not 去出差?
Why do you need to heat the pan before heating the olive oil?
Print the new site header
Print 'A' 1000 times with BrainFuck
Tips for golfing in brainfuckHow to shorten this J code? (Or write shorter code in another language)BrainF***-optimize a series of numbersVerify Brainfuck programImplement multiplication by a constant with addition and bit shiftsBrainf*** subprograms with unique outputsConvert Brainfuck to a Non-Golfing LanguageConvert Brainfuck to MarioLANGBetter way to read multiple int in C than scanfHow can I shorten this multiple assignment in Lua?Brainf*ck Loop Problem
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
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 ?
code-golf tips brainfuck
New contributor
$endgroup$
add a comment |
$begingroup$
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 ?
code-golf tips brainfuck
New contributor
$endgroup$
3
$begingroup$
This is a good place to start. Welcome to Code golf! :)
$endgroup$
– FryAmTheEggman
9 hours ago
2
$begingroup$
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.
$endgroup$
– Jonathan Allan
9 hours ago
3
$begingroup$
I 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?
$endgroup$
– Jonathan Frech
8 hours ago
$begingroup$
@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
$endgroup$
– Nelson G.
7 mins ago
add a comment |
$begingroup$
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 ?
code-golf tips brainfuck
New contributor
$endgroup$
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 ?
code-golf tips brainfuck
code-golf tips brainfuck
New contributor
New contributor
edited 6 mins ago
Nelson G.
New contributor
asked 9 hours ago
Nelson G.Nelson G.
1174
1174
New contributor
New contributor
3
$begingroup$
This is a good place to start. Welcome to Code golf! :)
$endgroup$
– FryAmTheEggman
9 hours ago
2
$begingroup$
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.
$endgroup$
– Jonathan Allan
9 hours ago
3
$begingroup$
I 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?
$endgroup$
– Jonathan Frech
8 hours ago
$begingroup$
@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
$endgroup$
– Nelson G.
7 mins ago
add a comment |
3
$begingroup$
This is a good place to start. Welcome to Code golf! :)
$endgroup$
– FryAmTheEggman
9 hours ago
2
$begingroup$
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.
$endgroup$
– Jonathan Allan
9 hours ago
3
$begingroup$
I 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?
$endgroup$
– Jonathan Frech
8 hours ago
$begingroup$
@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
$endgroup$
– Nelson G.
7 mins ago
3
3
$begingroup$
This is a good place to start. Welcome to Code golf! :)
$endgroup$
– FryAmTheEggman
9 hours ago
$begingroup$
This is a good place to start. Welcome to Code golf! :)
$endgroup$
– FryAmTheEggman
9 hours ago
2
2
$begingroup$
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.
$endgroup$
– Jonathan Allan
9 hours ago
$begingroup$
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.
$endgroup$
– Jonathan Allan
9 hours ago
3
3
$begingroup$
I 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?$endgroup$
– Jonathan Frech
8 hours ago
$begingroup$
I 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?$endgroup$
– Jonathan Frech
8 hours ago
$begingroup$
@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
$endgroup$
– Nelson G.
7 mins ago
$begingroup$
@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
$endgroup$
– Nelson G.
7 mins ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
The method you seem to currently be using is 39 bytes:
>>+++[<-[-<.>]>-]++++[<----->-]<-[-<.>]
(not including getting the A
) (Try It Online!)
(loop 3 times, each time set the counter to 255 and print that many times, then subtract 20, subtract 1, and print that many times)
However, it is much shorter to loop 4 times and print 250 times each time:
>>++++[<------[<.>-]>-]
(23 bytes).
If your cells are unbounded (I'm assuming they're 8-bit otherwise you probably wouldn't try using 255 for golfing):
>>++++++++++[<++++++++++[<..........>-]>-]
(42 bytes).
$endgroup$
$begingroup$
this seems to assume 8-bit cells, though...
$endgroup$
– John Dvorak
9 hours ago
1
$begingroup$
@JohnDvorak: The question mentioned setting cells to 255 as a part of the most effective solution the OP could think of. That seems like a pretty clear indication of (ab)using 8-bit cell wrapping.
$endgroup$
– randomdude999
9 hours ago
$begingroup$
@JohnDvorak What randomdude999 said, but I did add a method using 10x10x10 in case the cells are unbounded.
$endgroup$
– HyperNeutrino
9 hours ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "200"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Nelson G. is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f186971%2fprint-a-1000-times-with-brainfuck%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
The method you seem to currently be using is 39 bytes:
>>+++[<-[-<.>]>-]++++[<----->-]<-[-<.>]
(not including getting the A
) (Try It Online!)
(loop 3 times, each time set the counter to 255 and print that many times, then subtract 20, subtract 1, and print that many times)
However, it is much shorter to loop 4 times and print 250 times each time:
>>++++[<------[<.>-]>-]
(23 bytes).
If your cells are unbounded (I'm assuming they're 8-bit otherwise you probably wouldn't try using 255 for golfing):
>>++++++++++[<++++++++++[<..........>-]>-]
(42 bytes).
$endgroup$
$begingroup$
this seems to assume 8-bit cells, though...
$endgroup$
– John Dvorak
9 hours ago
1
$begingroup$
@JohnDvorak: The question mentioned setting cells to 255 as a part of the most effective solution the OP could think of. That seems like a pretty clear indication of (ab)using 8-bit cell wrapping.
$endgroup$
– randomdude999
9 hours ago
$begingroup$
@JohnDvorak What randomdude999 said, but I did add a method using 10x10x10 in case the cells are unbounded.
$endgroup$
– HyperNeutrino
9 hours ago
add a comment |
$begingroup$
The method you seem to currently be using is 39 bytes:
>>+++[<-[-<.>]>-]++++[<----->-]<-[-<.>]
(not including getting the A
) (Try It Online!)
(loop 3 times, each time set the counter to 255 and print that many times, then subtract 20, subtract 1, and print that many times)
However, it is much shorter to loop 4 times and print 250 times each time:
>>++++[<------[<.>-]>-]
(23 bytes).
If your cells are unbounded (I'm assuming they're 8-bit otherwise you probably wouldn't try using 255 for golfing):
>>++++++++++[<++++++++++[<..........>-]>-]
(42 bytes).
$endgroup$
$begingroup$
this seems to assume 8-bit cells, though...
$endgroup$
– John Dvorak
9 hours ago
1
$begingroup$
@JohnDvorak: The question mentioned setting cells to 255 as a part of the most effective solution the OP could think of. That seems like a pretty clear indication of (ab)using 8-bit cell wrapping.
$endgroup$
– randomdude999
9 hours ago
$begingroup$
@JohnDvorak What randomdude999 said, but I did add a method using 10x10x10 in case the cells are unbounded.
$endgroup$
– HyperNeutrino
9 hours ago
add a comment |
$begingroup$
The method you seem to currently be using is 39 bytes:
>>+++[<-[-<.>]>-]++++[<----->-]<-[-<.>]
(not including getting the A
) (Try It Online!)
(loop 3 times, each time set the counter to 255 and print that many times, then subtract 20, subtract 1, and print that many times)
However, it is much shorter to loop 4 times and print 250 times each time:
>>++++[<------[<.>-]>-]
(23 bytes).
If your cells are unbounded (I'm assuming they're 8-bit otherwise you probably wouldn't try using 255 for golfing):
>>++++++++++[<++++++++++[<..........>-]>-]
(42 bytes).
$endgroup$
The method you seem to currently be using is 39 bytes:
>>+++[<-[-<.>]>-]++++[<----->-]<-[-<.>]
(not including getting the A
) (Try It Online!)
(loop 3 times, each time set the counter to 255 and print that many times, then subtract 20, subtract 1, and print that many times)
However, it is much shorter to loop 4 times and print 250 times each time:
>>++++[<------[<.>-]>-]
(23 bytes).
If your cells are unbounded (I'm assuming they're 8-bit otherwise you probably wouldn't try using 255 for golfing):
>>++++++++++[<++++++++++[<..........>-]>-]
(42 bytes).
edited 9 hours ago
answered 9 hours ago
HyperNeutrinoHyperNeutrino
20k440152
20k440152
$begingroup$
this seems to assume 8-bit cells, though...
$endgroup$
– John Dvorak
9 hours ago
1
$begingroup$
@JohnDvorak: The question mentioned setting cells to 255 as a part of the most effective solution the OP could think of. That seems like a pretty clear indication of (ab)using 8-bit cell wrapping.
$endgroup$
– randomdude999
9 hours ago
$begingroup$
@JohnDvorak What randomdude999 said, but I did add a method using 10x10x10 in case the cells are unbounded.
$endgroup$
– HyperNeutrino
9 hours ago
add a comment |
$begingroup$
this seems to assume 8-bit cells, though...
$endgroup$
– John Dvorak
9 hours ago
1
$begingroup$
@JohnDvorak: The question mentioned setting cells to 255 as a part of the most effective solution the OP could think of. That seems like a pretty clear indication of (ab)using 8-bit cell wrapping.
$endgroup$
– randomdude999
9 hours ago
$begingroup$
@JohnDvorak What randomdude999 said, but I did add a method using 10x10x10 in case the cells are unbounded.
$endgroup$
– HyperNeutrino
9 hours ago
$begingroup$
this seems to assume 8-bit cells, though...
$endgroup$
– John Dvorak
9 hours ago
$begingroup$
this seems to assume 8-bit cells, though...
$endgroup$
– John Dvorak
9 hours ago
1
1
$begingroup$
@JohnDvorak: The question mentioned setting cells to 255 as a part of the most effective solution the OP could think of. That seems like a pretty clear indication of (ab)using 8-bit cell wrapping.
$endgroup$
– randomdude999
9 hours ago
$begingroup$
@JohnDvorak: The question mentioned setting cells to 255 as a part of the most effective solution the OP could think of. That seems like a pretty clear indication of (ab)using 8-bit cell wrapping.
$endgroup$
– randomdude999
9 hours ago
$begingroup$
@JohnDvorak What randomdude999 said, but I did add a method using 10x10x10 in case the cells are unbounded.
$endgroup$
– HyperNeutrino
9 hours ago
$begingroup$
@JohnDvorak What randomdude999 said, but I did add a method using 10x10x10 in case the cells are unbounded.
$endgroup$
– HyperNeutrino
9 hours ago
add a comment |
Nelson G. is a new contributor. Be nice, and check out our Code of Conduct.
Nelson G. is a new contributor. Be nice, and check out our Code of Conduct.
Nelson G. is a new contributor. Be nice, and check out our Code of Conduct.
Nelson G. is a new contributor. Be nice, and check out our Code of Conduct.
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f186971%2fprint-a-1000-times-with-brainfuck%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
$begingroup$
This is a good place to start. Welcome to Code golf! :)
$endgroup$
– FryAmTheEggman
9 hours ago
2
$begingroup$
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.
$endgroup$
– Jonathan Allan
9 hours ago
3
$begingroup$
I 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?$endgroup$
– Jonathan Frech
8 hours ago
$begingroup$
@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
$endgroup$
– Nelson G.
7 mins ago