Skip to main content
Oops BuzzFizz
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Gol><>, 40 bytes

`e2RFL3%zR"zziF"L5%zR"zzuB"lQlRoaoC|LN|;`e2RFL5%zR"zzuB"L3%zR"zziF"lQlRoaoC|LN|;

Updated for 0.4.0! I'm still tinkering with loops and trying to figure out how to do things best, but this is looking good so far.

Try it onlineTry it online.

Explanation

`e            Push 'e', or 101
2RF ... |     Execute F for loop twice - the first time activates the loop, and the
              second time updates it. This effectively makes the loop start from 1
L3%zL5%z          Push 1 if loop counter % 35 is 0, else 1
R"zziF"R"zzuB"       Push "Fizz""Buzz" (top of stack) number of times
L5%zL3%z          Push 1 if loop counter % 53 is 0, else 1
R"zzuB"R"zziF"       Push "Buzz""Fizz" (top of stack) number of times
lQ ... |      If the stack is not empty...
  lRo         Output stack
  ao          Output newline
  C           Continue for loop
LN            Otherwise, print loop counter with newline

;             Terminate program

As we can see, there's a lot of abuse of R, which pops the top of the stack and executes the next instruction that many times.

Gol><>, 40 bytes

`e2RFL3%zR"zziF"L5%zR"zzuB"lQlRoaoC|LN|;

Updated for 0.4.0! I'm still tinkering with loops and trying to figure out how to do things best, but this is looking good so far.

Try it online.

Explanation

`e            Push 'e', or 101
2RF ... |     Execute F for loop twice - the first time activates the loop, and the
              second time updates it. This effectively makes the loop start from 1
L3%z          Push 1 if loop counter % 3 is 0, else 1
R"zziF"       Push "Fizz" (top of stack) number of times
L5%z          Push 1 if loop counter % 5 is 0, else 1
R"zzuB"       Push "Buzz" (top of stack) number of times
lQ ... |      If the stack is not empty...
  lRo         Output stack
  ao          Output newline
  C           Continue for loop
LN            Otherwise, print loop counter with newline

;             Terminate program

As we can see, there's a lot of abuse of R, which pops the top of the stack and executes the next instruction that many times.

Gol><>, 40 bytes

`e2RFL5%zR"zzuB"L3%zR"zziF"lQlRoaoC|LN|;

Updated for 0.4.0! I'm still tinkering with loops and trying to figure out how to do things best, but this is looking good so far.

Try it online.

Explanation

`e            Push 'e', or 101
2RF ... |     Execute F for loop twice - the first time activates the loop, and the
              second time updates it. This effectively makes the loop start from 1
L5%z          Push 1 if loop counter % 5 is 0, else 1
R"zzuB"       Push "Buzz" (top of stack) number of times
L3%z          Push 1 if loop counter % 3 is 0, else 1
R"zziF"       Push "Fizz" (top of stack) number of times
lQ ... |      If the stack is not empty...
  lRo         Output stack
  ao          Output newline
  C           Continue for loop
LN            Otherwise, print loop counter with newline

;             Terminate program

As we can see, there's a lot of abuse of R, which pops the top of the stack and executes the next instruction that many times.

added 314 characters in body
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Gol><>, 45 bytes

Gol><>, 40 bytes

0PV0`d)?;05%z6Q"zzuB"03%z6Q"zziF"lz3Q0NtlRoao`e2RFL3%zR"zziF"L5%zR"zzuB"lQlRoaoC|LN|;

Try it online.

This answer is valid as ofUpdated for 0.3.114. New features might change things/make0! I'm still tinkering with loops and trying to figure out how to do things golfier in the futurebest, but I think this is prettylooking good with current featuresso far.

Explanation

Try it online.

Explanation

0 `e            Push First'e', iteration:or push101
2RF 0... Every| iteration after: push n-1.
P Execute F for loop twice - the first time activates the loop, and Incrementthe
V0             Save nsecond intime variableupdates 0it. (almostThis anyeffectively charmakes canthe beloop astart variablefrom name)1
`d)?;L3%z          HaltPush 1 if >loop 100counter % 3 is 0, else 1
05%z6Q"zzuB"R"zziF"       Push "Buzz""Fizz" if(top n%5of ==stack) 0number of times
03%z6Q"zziF"L5%z          Push "Fizz"1 if n%3loop ==counter % 5 is 0, else 1
lz3Q0NtR"zzuB"       Push "Buzz" (top of stack) number of times
lQ ... |      If the stack is not empty,...
 print nlRo and continue loop with t    Output stack
lRoao  ao          Output newline
  C           Continue for loop
LN            Otherwise, print theloop stackcounter followedwith bynewline

; a newline and continue loop        Terminate program

As we can see, there's a lot of abuse of R, which pops the top of the stack and executes the next instruction that many times.

Gol><>, 45 bytes

0PV0`d)?;05%z6Q"zzuB"03%z6Q"zziF"lz3Q0NtlRoao

Try it online.

This answer is valid as of 0.3.11. New features might change things/make things golfier in the future, but I think this is pretty good with current features.

Explanation

0              First iteration: push 0. Every iteration after: push n-1.
P              Increment
V0             Save n in variable 0 (almost any char can be a variable name)
`d)?;          Halt if > 100
05%z6Q"zzuB"   Push "Buzz" if n%5 == 0
03%z6Q"zziF"   Push "Fizz" if n%3 == 0
lz3Q0Nt        If the stack is empty, print n and continue loop with t
lRoao          Otherwise, print the stack followed by a newline and continue loop

Gol><>, 40 bytes

`e2RFL3%zR"zziF"L5%zR"zzuB"lQlRoaoC|LN|;

Updated for 0.4.0! I'm still tinkering with loops and trying to figure out how to do things best, but this is looking good so far.

Try it online.

Explanation

`e            Push 'e', or 101
2RF ... |     Execute F for loop twice - the first time activates the loop, and the
              second time updates it. This effectively makes the loop start from 1
L3%z          Push 1 if loop counter % 3 is 0, else 1
R"zziF"       Push "Fizz" (top of stack) number of times
L5%z          Push 1 if loop counter % 5 is 0, else 1
R"zzuB"       Push "Buzz" (top of stack) number of times
lQ ... |      If the stack is not empty...
  lRo         Output stack
  ao          Output newline
  C           Continue for loop
LN            Otherwise, print loop counter with newline

;             Terminate program

As we can see, there's a lot of abuse of R, which pops the top of the stack and executes the next instruction that many times.

Incorrect byte count
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287

Gol><>, 4445 bytes

0PV0`d)?;05%z6Q"zzuB"03%z6Q"zziF"lz3Q0NtlRoao

Try it online.

This answer is valid as of 0.3.11. New features might change things/make things golfier in the future, but I think this is pretty good with current features.

Explanation

0              First iteration: push 0. Every iteration after: push n-1.
P              Increment
V0             Save n in variable 0 (almost any char can be a variable name)
`d)?;          Halt if > 100
05%z6Q"zzuB"   Push "Buzz" if n%5 == 0
03%z6Q"zziF"   Push "Fizz" if n%3 == 0
lz3Q0Nt        If the stack is empty, print n and continue loop with t
lRoao          Otherwise, print the stack followed by a newline and continue loop

Gol><>, 44 bytes

0PV0`d)?;05%z6Q"zzuB"03%z6Q"zziF"lz3Q0NtlRoao

Try it online.

This answer is valid as of 0.3.11. New features might change things/make things golfier in the future, but I think this is pretty good with current features.

Explanation

0              First iteration: push 0. Every iteration after: push n-1.
P              Increment
V0             Save n in variable 0 (almost any char can be a variable name)
`d)?;          Halt if > 100
05%z6Q"zzuB"   Push "Buzz" if n%5 == 0
03%z6Q"zziF"   Push "Fizz" if n%3 == 0
lz3Q0Nt        If the stack is empty, print n and continue loop with t
lRoao          Otherwise, print the stack followed by a newline and continue loop

Gol><>, 45 bytes

0PV0`d)?;05%z6Q"zzuB"03%z6Q"zziF"lz3Q0NtlRoao

Try it online.

This answer is valid as of 0.3.11. New features might change things/make things golfier in the future, but I think this is pretty good with current features.

Explanation

0              First iteration: push 0. Every iteration after: push n-1.
P              Increment
V0             Save n in variable 0 (almost any char can be a variable name)
`d)?;          Halt if > 100
05%z6Q"zzuB"   Push "Buzz" if n%5 == 0
03%z6Q"zziF"   Push "Fizz" if n%3 == 0
lz3Q0Nt        If the stack is empty, print n and continue loop with t
lRoao          Otherwise, print the stack followed by a newline and continue loop
Source Link
Sp3000
  • 61.9k
  • 13
  • 115
  • 287
Loading