Write a script that outputs A
to stdout infinitely.
There should be no newlines or separators between the characters.
Standard loopholes apply.
This is code-golf. The shortest solution in each language wins.
Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It only takes a minute to sign up.
Sign up to join this communityWrite a script that outputs A
to stdout infinitely.
There should be no newlines or separators between the characters.
Standard loopholes apply.
This is code-golf. The shortest solution in each language wins.
--live-output
, 59 bytesThis uses the --live-output
flag otherwise output would be deferred until the end of the program, which would never happen because the program doesn't end.
a b c d e f
a b c d e f g h
a b c d e f g
a b c d e f g h i
Golfed version of the following code:
This program will ask you for
some input but I really only care about
the first character of input. I'm gonna
take such a character and output it MANY times.
To try this, clone this GH repo and run python brainetry.py btry/scream.btry
and give it A
as input.
a/A
loop
print
end
a/A
Append A to the empty input.
loop
print
end
Starts an infinite loop where you print the input.
'A{_o}h
CJam loops are surprisingly expensive as there are no markers, and since there's no infinite loop function, we need to make sure there's always a spare truthy A on the stack for our do-while loop.
Explanation:
'A Push 'A' to the stack
{ }h Loop while top of stack is true
_ Duplicate the A
o Pop and output the A w/ no newline
fn main(){while(1){prc!(65)}}
This may have to be changed to fn main(){while(1){prc!('A')}}
once num and char are no longer interchangable, but for now it works.
ͻ # Infinite loop
( # Decompress base 255
A # A
) #
B # Compress number to base 255
So, yeah I'm using write()
system call to print A
characters without \n
6 scream: 7 00000000 6A41 push 0x41 8 00000002 31DB xor ebx, ebx 9 00000004 89E1 mov ecx, esp 10 00000006 B201 mov dl, 0x1 11 00000008 B004 mov al, 0x4 12 0000000A CD80 int 0x80 13 0000000C EBF2 jmp scream
This is output using strace
:
write(0, "A", 1A) = 1
write(0, "A", 1A) = 1
write(0, "A", 1A) = 1
write(0, "A", 1A) = 1
<repeat> ..
avqviiimtfu
a - push 0 to stack
v - add 5
q - duplicate
viii - add 8 (making 13)
m - multiply top 2 items (13x5 = 65)
t - start bf style loop
f - print character
u - end bf style loop
class P{static void Main(){for(;;)System.Console.Write('A');}}
{iiiiii}iiiii{{{{{{{{{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}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
Sets the accumulator to 65, then prints as character 102000 times = far beyond the lifespan of the universe.
There's no way to do anything infinitely in Deadfish~, so 102000 times should be enough.
Do
WScript.StdOut.Write("A")
Loop
for(;;)Console.Write('A');
.
\$\endgroup\$
Aug 19, 2021 at 13:47
System
is added as a using
directive with every class file generated. So creating a new console app to test this will include the System
namespace by default. Plus, you can add a web link for testing with DotNETFiddle which also includes System
by default with new fiddles.
\$\endgroup\$
Aug 19, 2021 at 17:07
System
using is not added by default.
\$\endgroup\$
Aug 19, 2021 at 19:28
^A¤p←1
Explanation:
^A // Sets the accumulator to the ASCII codepoint of 'A'.
¤ ←1 // Creates a jump target and jumps back to it.
p // Prints the accumulator as a character value.
Since the ←
command will implicitly push the current location onto the location pointer stack, this program will use lots of system memory. In fact, on my system it used about one megabyte of RAM per second. To overcome this, I've since implemented the ↰
operator, which jumps without pushing (and therefore removes the possibility of RAM overflow). It makes the command look like this: ^A¤p↰1
This could be 8 bytes now that I have implemented the infinite loop that I'd thought about implementing: ^65#∞p
In this case, the #∞p
would define a loop which would print the character value infinitely. However, since the infinity command may have been inspired by this (I actually forget) and the command is newer than the answer anyway, I'll refrain from changing my answer.
loop{$><<?A}
loop {...} //infinite loop
$> //synonym for STDOUT
<<?A // << appends an element and ?A is shorthand for 'A'
['A.:!]v*:!
[ :!]v*:! // infinite loop
'A. // with the side effect of outputting 'A' each iteration
I feel a bit scummy for reposting the same code to multiple questions, but I guess it has to be done.
-as ''
, 2 bytesA+
With the -a
flag, Regenerate outputs all strings that match the given regex. With the -s
flag setting the separator to ''
, it outputs them with no separator. The output with a newline separator would look like...
A
AA
AAA
... but with an empty separator, it's just an unending stream of A
.
while 1>0:stdout.write'A'
Not great, but not too shabby.
stdout.write
.
\$\endgroup\$
There's two! Each instruction is a hex, so two instructions fit in a byte.
$$$(([]!)/(/[]!)):><
OPLEV 0:
$$$ Allocate 8 bits of memory to the bit tape
(([]!)/(/[]!)) Set the bit tape to 01000001
:>< Print the bit tape, and loop to the beginning
OPLEV 1:
... NOP
((().)/(/().)) Moves around the bit tape with no effect
:>< Print the bit tape, and loop to the beginning
This one is simpler, but it's 20 instructions and an extra byte. The first time the program loops, the operation level is 0, and it runs the first program, which allocates memory, sets the bit tape to 'A', and prints. Every other time it loops it just prints the bit tape.
%!)))):((((><
%! Acts as NOP, encodes 'A'
)))) Moves data reader to '%!'/'A'
:((((>< Prints, resets position, and loops to beginning
This one reads its own source code, and is a few bytes smaller. The operation level does change, but it doesn't really affect any of the program. When attempting to MERGE
()
) while selecting the entire but tape, which is the original state of the program, the data reader moves to the parent bit tape, which is the program's source code. The program navigates to the %!
, prints it as 'A'
, and loops.
'A|o
Explanation:
'A Pushes the character literal A to the stack\
| Loop the rest of the code infinitely\
o Output
Yes, Wedgescript is a custom language made by me, here is the repo with interpreter install instructions: https://github.com/WedgeScript/WedgeScript
{Oo'A}g1/0
{Oo'A}a
{ // Function
Oo'A // Output 'A'
} // End Function
g1/0 // Call infinite times
// (Japt's O.o() method returns undefined)
As pointed out by @Shaggy due to how a
is implemented this will print A
only 1e8
times
{Oo'A}a
{Oo'A}a
{ // Function
Oo'A // Output 'A'
} // End Function
a // Call repeatedly until it returns a truthy value
// (Japt's O.o() method returns undefined)
void setup(){Serial.begin(300);}void loop(){Serial.write('A');}
Not sure how much explaining I need to do here. Arduino has an infinite loop built-in, so just write one 'A'
to the Serial output inside of it. Equally valid would be Serial.print('A');
and Serial.print("A");
, and I think Serial.write("A");
should work as well. It's all just a matter of preference.
The try it link has the 5
flag to prevent it from freezing up forever.
{\A₴
{ - While loop
\A - Push "A"
₴ - Print without newline
DO,1<-#9DO,1SUB#1<-#126DOCOMEFROM#9PLEASEREADOUT,1(9)DO,1<-#9