Skip to main content
Updating to new interpreter
Source Link
d01
  • 3.4k
  • 13
  • 26

Rattle, 54 44 bytes

Fizz&Buzz|!I=[g+bs%3[0b0b^0]g%5[0b1b^0]B]100

Try it Online!Try it Online!

This [was] my first answer in my new programming language! (This answer has since been golfed, and works on my new online interpreter)

Eventually, this programming language might have a more concise way to solve this challenge.

^this ended up being true - after a couple updates, 10 bytes can be shaved off the original answer (without implementing trivial built-ins)

Explanation

Fizz&Buzz         a variable containing the text Fizz and Buzz
|                 signals the end of the input
!                 is a flag to disable implicit printing at EOF
I                 splits the variable into parts and stores it in consecutive memory slots
=                 sets top of stack to 0
[                 start outer loop
g+bs              gets value at slot 3 (starts at zero), increments, appends it to a buffer, saves it to slot 3
%3                takes the current value on stack and pushes the value mod 3 to stack
[0b0b^0]          if the value on stack is equal to 0, concatenates value from memory slot 0 ("Fizz") to a buffer and nullifies the 0th element of the buffer
g%5               pushes value from slot 3 to stack, takes the value and pushes the value mod 5 to stack
[0b1b^0]          if the value on stack is equal to 0, concatenates the value from memory slot 1 ("Buzz") to the buffer and nullifies the 0th element of the buffer if not null already
B                 if the buffer is non-empty, prints buffer
]100              end outer loop - repeats 100 times

Rattle, 54 44 bytes

Fizz&Buzz|!I=[g+bs%3[0b0b^0]g%5[0b1b^0]B]100

Try it Online!

This [was] my first answer in my new programming language! (This answer has since been golfed, and works on my new online interpreter)

Eventually, this programming language might have a more concise way to solve this challenge.

^this ended up being true - after a couple updates, 10 bytes can be shaved off the original answer (without implementing trivial built-ins)

Explanation

Fizz&Buzz         a variable containing the text Fizz and Buzz
|                 signals the end of the input
!                 is a flag to disable implicit printing at EOF
I                 splits the variable into parts and stores it in consecutive memory slots
=                 sets top of stack to 0
[                 start outer loop
g+bs              gets value at slot 3 (starts at zero), increments, appends it to a buffer, saves it to slot 3
%3                takes the current value on stack and pushes the value mod 3 to stack
[0b0b^0]          if the value on stack is equal to 0, concatenates value from memory slot 0 ("Fizz") to a buffer and nullifies the 0th element of the buffer
g%5               pushes value from slot 3 to stack, takes the value and pushes the value mod 5 to stack
[0b1b^0]          if the value on stack is equal to 0, concatenates the value from memory slot 1 ("Buzz") to the buffer and nullifies the 0th element of the buffer if not null already
B                 if the buffer is non-empty, prints buffer
]100              end outer loop - repeats 100 times

Rattle, 54 44 bytes

Fizz&Buzz|!I=[g+bs%3[0b0b^0]g%5[0b1b^0]B]100

Try it Online!

This [was] my first answer in my new programming language! (This answer has since been golfed, and works on my new online interpreter)

Eventually, this programming language might have a more concise way to solve this challenge.

^this ended up being true - after a couple updates, 10 bytes can be shaved off the original answer (without implementing trivial built-ins)

Explanation

Fizz&Buzz         a variable containing the text Fizz and Buzz
|                 signals the end of the input
!                 is a flag to disable implicit printing at EOF
I                 splits the variable into parts and stores it in consecutive memory slots
=                 sets top of stack to 0
[                 start outer loop
g+bs              gets value at slot 3 (starts at zero), increments, appends it to a buffer, saves it to slot 3
%3                takes the current value on stack and pushes the value mod 3 to stack
[0b0b^0]          if the value on stack is equal to 0, concatenates value from memory slot 0 ("Fizz") to a buffer and nullifies the 0th element of the buffer
g%5               pushes value from slot 3 to stack, takes the value and pushes the value mod 5 to stack
[0b1b^0]          if the value on stack is equal to 0, concatenates the value from memory slot 1 ("Buzz") to the buffer and nullifies the 0th element of the buffer if not null already
B                 if the buffer is non-empty, prints buffer
]100              end outer loop - repeats 100 times
Golfing (removing 10 bytes - see answer history for original answer)
Source Link
d01
  • 3.4k
  • 13
  • 26

Rattle, 5454 44 bytes

Fizz&Buzz|!sSs1S1s2P3[g+R1bs%3[0b1b^0]g%5[0b2b^0]B]100I=[g+bs%3[0b0b^0]g%5[0b1b^0]B]100

Try it online!Try it Online!

This is[was] my first answer in my new programming language! Please note: this language is not available yet on TIO, but because the interpreter itself is in Python 3, then I can still provide links to my answers. For these answers, the interpreter itself is in the header while the code for Rattle is in the actual code section. Eventually(This answer has since been golfed, Rattle will probably be added to TIO and the above code will run natively. If you hit runworks on TIO, this code will still produce the correct output.my new online interpreter)

I am also still open to suggestions for what to name my language - Rattle is simply a placeholder.Eventually, this programming language might have a more concise way to solve this challenge.

If you're interested in learning this new language, I would recommend you wait about^this ended up being true - after a week. I admitcouple updates, 10 bytes can be shaved off the documentation is not great yet but I'm working on improving it.

Eventually, this programming language might have a more concise way to solve this challenge.original answer (without implementing trivial built-ins)

Fizz&Buzz         is a hard-coded input whichvariable getscontaining splitthe automaticallytext intoFizz aand listBuzz
|                 signals the end of the input
!                 is a flag to disable implicit printing at EOF
sS          I      saves the list to memory slot 0, selects the first index ofsplits the list
s1S1         variable into parts and stores savesit thisin toconsecutive memory slot 1, selects list index 2slots
s2P3 =             saves this to memory slotsets 2,top movesof pointerstack to slot 30
[                 start outer loop
g+R1bsg+bs              gets value at slot 3 (initializedstarts toat zero), increments, reformats it as an integer, appends it to a buffer, saves it to slot 3
%3                takes the current value on stack and pushes the value mod 3 to stack
[0b1b^0][0b0b^0]          if the value on stack is equal to 0, concatenates value from memory slot 10 ("Fizz") to a buffer and nullifies the 0th element of the buffer
g%5               pushes value from slot 3 to stack, takes the value and pushes the value mod 5 to stack
[0b2b^0][0b1b^0]          if the value on stack is equal to 0, concatenates the value from memory slot 21 ("Buzz") to the buffer and nullifies the 0th element of the buffer if not null already
B                 if the buffer is non-empty, prints buffer
]100              end outer loop - repeats 100 times

Rattle, 54 bytes

Fizz&Buzz|!sSs1S1s2P3[g+R1bs%3[0b1b^0]g%5[0b2b^0]B]100

Try it online!

This is my first answer in my new programming language! Please note: this language is not available yet on TIO, but because the interpreter itself is in Python 3, then I can still provide links to my answers. For these answers, the interpreter itself is in the header while the code for Rattle is in the actual code section. Eventually, Rattle will probably be added to TIO and the above code will run natively. If you hit run on TIO, this code will still produce the correct output.

I am also still open to suggestions for what to name my language - Rattle is simply a placeholder.

If you're interested in learning this new language, I would recommend you wait about a week. I admit, the documentation is not great yet but I'm working on improving it.

Eventually, this programming language might have a more concise way to solve this challenge.

Fizz&Buzz         is a hard-coded input which gets split automatically into a list
|                 signals the end of the input
!                 is a flag to disable implicit printing at EOF
sS                saves the list to memory slot 0, selects the first index of the list
s1S1              saves this to memory slot 1, selects list index 2
s2P3              saves this to memory slot 2, moves pointer to slot 3
[                 start outer loop
g+R1bs            gets value at slot 3 (initialized to zero), increments, reformats it as an integer, appends it to a buffer, saves it to slot 3
%3                takes the current value on stack and pushes the value mod 3 to stack
[0b1b^0]          if the value on stack is equal to 0, concatenates value from memory slot 1 to a buffer and nullifies the 0th element of the buffer
g%5               pushes value from slot 3 to stack, takes the value and pushes the value mod 5 to stack
[0b2b^0]          if the value on stack is equal to 0, concatenates the value from memory slot 2 to the buffer and nullifies the 0th element of the buffer if not null already
B                 if the buffer is non-empty, prints buffer
]100              end outer loop - repeats 100 times

Rattle, 54 44 bytes

Fizz&Buzz|!I=[g+bs%3[0b0b^0]g%5[0b1b^0]B]100

Try it Online!

This [was] my first answer in my new programming language! (This answer has since been golfed, and works on my new online interpreter)

Eventually, this programming language might have a more concise way to solve this challenge.

^this ended up being true - after a couple updates, 10 bytes can be shaved off the original answer (without implementing trivial built-ins)

Fizz&Buzz         a variable containing the text Fizz and Buzz
|                 signals the end of the input
!                 is a flag to disable implicit printing at EOF
I                 splits the variable into parts and stores it in consecutive memory slots
=                 sets top of stack to 0
[                 start outer loop
g+bs              gets value at slot 3 (starts at zero), increments, appends it to a buffer, saves it to slot 3
%3                takes the current value on stack and pushes the value mod 3 to stack
[0b0b^0]          if the value on stack is equal to 0, concatenates value from memory slot 0 ("Fizz") to a buffer and nullifies the 0th element of the buffer
g%5               pushes value from slot 3 to stack, takes the value and pushes the value mod 5 to stack
[0b1b^0]          if the value on stack is equal to 0, concatenates the value from memory slot 1 ("Buzz") to the buffer and nullifies the 0th element of the buffer if not null already
B                 if the buffer is non-empty, prints buffer
]100              end outer loop - repeats 100 times
fixing explanation
Source Link
d01
  • 3.4k
  • 13
  • 26

RattleRattle, 54 bytes

Try it online!Try it online!

This is my first answer in my new programming language! Please note: this language is not available yet on TIO, but because the interpreter itself is in Python 3, then I can still provide links to my answers. For these answers, the interpreter itself is in the header while the code for Rattle is in the actual code section. Note that the \ in the code section is necessary only as a continuation character and is not part of the Rattle code. Eventually, Rattle will probably be added to TIO and the above code will run natively. If you hit run on TIO, this code will still produce the correct output.

Fizz&Buzz         is a hard-coded input which gets split automatically into a list
|                 signals the end of the input
!                 is a flag to disable implicit printing at EOF
sS                saves the list to memory slot 0, selects the first index of the list
s1S1              saves this to memory slot 1, selects list index 2
s2P3              saves this to memory slot 2, moves pointer to slot 3
[                 start outer loop
g+is  g+R1bs            gets value at slot 3 (initialized to zero), increments, printsreformats it as an integer, appends it to a buffer, saves it to slot 3
%3                takes the current value on stack and pushes the value mod 3 to stack
[0b1]   [0b1b^0]          if the value on stack is equal to 0, concatenates value from memory slot 1 to a buffer and nullifies the 0th element of the buffer
g%5               pushes value from slot 3 to stack, takes the value and pushes the value mod 5 to stack
[0b2]   [0b2b^0]          if the value on stack is equal to 0, concatenates the value from memory slot 2 to the buffer and nullifies the 0th element of the buffer if not null already
B                 if the buffer is non-empty, prints buffer
]100              end outer loop - repeats 100 times

edit: This new version actually replaces the numbers with Fizz and/or Buzz, the last version did not

Rattle, 54 bytes

Try it online!

This is my first answer in my new programming language! Please note: this language is not available yet on TIO, but because the interpreter itself is in Python 3, then I can still provide links to my answers. For these answers, the interpreter itself is in the header while the code for Rattle is in the actual code section. Note that the \ in the code section is necessary only as a continuation character and is not part of the Rattle code. Eventually, Rattle will probably be added to TIO and the above code will run natively. If you hit run on TIO, this code will still produce the correct output.

Fizz&Buzz         is a hard-coded input which gets split automatically into a list
|                 signals the end of the input
!                 is a flag to disable implicit printing at EOF
sS                saves the list to memory slot 0, selects the first index of the list
s1S1              saves this to memory slot 1, selects list index 2
s2P3              saves this to memory slot 2, moves pointer to slot 3
[                 start outer loop
g+is              gets value at slot 3 (initialized to zero), increments, prints it as an integer, saves to slot 3
%3                takes the current value on stack and pushes the value mod 3 to stack
[0b1]             if the value on stack is equal to 0, concatenates value from memory slot 1 to a buffer
g%5               pushes value from slot 3 to stack, takes the value and pushes the value mod 5 to stack
[0b2]             if the value on stack is equal to 0, concatenates the value from memory slot 2 to the buffer
B                 if the buffer is non-empty, prints buffer
]100              end outer loop - repeats 100 times

edit: This new version actually replaces the numbers with Fizz and/or Buzz, the last version did not

Rattle, 54 bytes

Try it online!

This is my first answer in my new programming language! Please note: this language is not available yet on TIO, but because the interpreter itself is in Python 3, then I can still provide links to my answers. For these answers, the interpreter itself is in the header while the code for Rattle is in the actual code section. Eventually, Rattle will probably be added to TIO and the above code will run natively. If you hit run on TIO, this code will still produce the correct output.

Fizz&Buzz         is a hard-coded input which gets split automatically into a list
|                 signals the end of the input
!                 is a flag to disable implicit printing at EOF
sS                saves the list to memory slot 0, selects the first index of the list
s1S1              saves this to memory slot 1, selects list index 2
s2P3              saves this to memory slot 2, moves pointer to slot 3
[                 start outer loop
g+R1bs            gets value at slot 3 (initialized to zero), increments, reformats it as an integer, appends it to a buffer, saves it to slot 3
%3                takes the current value on stack and pushes the value mod 3 to stack
[0b1b^0]          if the value on stack is equal to 0, concatenates value from memory slot 1 to a buffer and nullifies the 0th element of the buffer
g%5               pushes value from slot 3 to stack, takes the value and pushes the value mod 5 to stack
[0b2b^0]          if the value on stack is equal to 0, concatenates the value from memory slot 2 to the buffer and nullifies the 0th element of the buffer if not null already
B                 if the buffer is non-empty, prints buffer
]100              end outer loop - repeats 100 times
added 4 characters in body
Source Link
d01
  • 3.4k
  • 13
  • 26
Loading
added 3 characters in body
Source Link
d01
  • 3.4k
  • 13
  • 26
Loading
added 1080 characters in body
Source Link
d01
  • 3.4k
  • 13
  • 26
Loading
Source Link
d01
  • 3.4k
  • 13
  • 26
Loading