Write a script that outputs
A to stdout infinitely.
There shold be no newlines or seperators 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 community
in more readable form:
S65 T S0 B0
S65 load 'A' into register T output it S0 B0 jump to the beginning
Derived from my answer to "Shortest code to produce infinite output".
This works because the
ɒ instruction don't do anything with the loop index except to check if
index < limit. If it is, it loops back to its associated
ɑ. Otherwise it exits the loop (index manipulation is handled with
"A"10ɑbuɒ "A" (Push "A") 10 (Loop bounds: 0 to 1) ɑ (Start loop) b (Copy top) u (Print with no trailing) ɒ (End loop)
,.Ajax,.Puck,.Act I:.Scene I:.[Exeunt][Enter Ajax and Puck] Ajax:You is the sum ofthe cube ofa big big cat a cat.Speak thy.Let usAct I.
(Newline added for readability.)
The ASCII code for A is 65, which is represented following this trick as \$65 = (2\cdot 2\cdot 1)^3 +1\$. Puck will say
Prints 'A' to the console indefinitely.
The main program pushes
77033|5|463 on the frame, and the last section,
4 swaps it with the previous section, a single
6 pacifies the
5 back into
3 outputs the
5, specifying output format 5 ("US-TTY"), and deletes the
463 section which is now before it.
77033 is left on the frame, and it runs in a loop forever.
7703 creates an empty section and a section with
63, which is outputted by
63 contains an anonymous command, so it can't be output directly. Instead, it is pacified and
7 is added before it, and the resulting string
703 is outputted. In output format 5,
7 is ignored and
03 corresponds to the character
A, which is printed to STDOUT. The
77033 section hasn't been deleted (because we added an empty section to get deleted by
3 instead), so it runs again.
(0)>0 (1)+ (2)Y[65,>1,>0] (3)p (4)<0 (2,1)<0 (0,1)<1
In essence, this just loops the ball on an add 1 loop until it reaches 65, then it bounces back and forth over p repeatedly printing "A"
[ ] # Push a macro to the stack 65 # Push the number 65 to the stack P # Pop and print ASCII char 65 (i.e. "A") with no newline d # Duplicate the macro x # Pop and execute the macro at the top-of-stack (tail recursion) d # Duplicate the macro x # Pop and execute the macro at the top-of-stack
You need an extra newline to enter the instruction. It's a modification of this solution.
The trailing newline is significant.
/ Start a command: - Replicate forever A The target for replication is the / character Extra newline to enter the instruction You end up with a cell with an infinite number of A's. However, the current cell can only show a finite amount of A's because cells are trunctuated based on their lengths. ```
1 # Push a 1 ↑ # While true without popping, É # using the following 3 commands: 'A '# Push an "A" q # Pop and print it without trailing newline ▲ # Do while true with pop, æ # using the following 4 commands: 'A '# Push an "A" _ # Duplicate this "A" q # Pop and print it without trailing newline
yes A|tr -cd A
will very quickly output A's.
3. start of code
6 assigns to cell 00 the value 65
8 starts the loop, keeps running while cell 00 is not zero.
5 prints ASCII character of the cell 00
9 closes the loop
4 end of code
Kenbark-1 (first personal computer) 6/7 bytes
002: 024 X 004 PC 234 200 Print A from X 343 004 jump back to begin of the program
Register X is on Address 002 (oct) Then we set program Counter (address 003) to 004 for starting code. Move value from X (024='A') to output register what is set of lights on device front (Address 200 oct). And unconditional jump back to address 004.
User will see steady light, but in reality computer still output A
I'm not sure how to count bytes since that
002: is needed to tell computer what part of memory we need to fill.
Try it by yourself: http://www.neocomputer.org/kenbak/kenbak1-JS.html