U+O[+O[ORO[]]+E.U-):R-OU[UO]OUO[]]+E;U({])UU+O[]]E:?-(}.
Prints the word debug
fib(n) times, where n is the number of copies, separated by newlines. This relies on the fact that DSO doesn't actually provide any debug info when the debug operation is called. it just prints the word 'debug'. Pretty funny stuff!
Linking up to 6 copies because that's how many it took to convince myself:
Try It Online!, Try It Online!x2, Try It Online!x3, Try It Online!x4, Try It Online!x5, Try It Online!x6
Explanation:
Overall strategy: Each repeat of the code (we will call them "chunks") just aims to print enough 'debug's to reach the next fibonacci number. So the first chunk needs to print 1, since fib(1) = 1, but chunk two doesn't want to print anything, since chunk one already got us to fib(2) = 1, but then chunk three wants to print one more, since fib(3) = 2... etc etc etc. Luckily, there is a sequence which describes exactly this phenomenon:
1 0 1 1 2 3 5 8 13 21...
It is the fibonacci sequence.
Each chunk increments a global variable (called i
in the explanation below) and runs a short loop to get fib(i) but with fib starting with 1, 0. Then, it prints 'debug' that many times before moving on to the next chunk.
U+O[+O[ORO[]]+E. code block 0 (and 2, and 4...)
U+O if i exists, i++, else let i = 1
[+O let a = 1
[O let b = 0
RO dont worry about it
[]]+E go to code block 2*(i-1)+1
with these values
. end code block
U-):R-OU[UO]OUO[]]+E;U({])UU+O[]]E:?-(}. code block 1 (and 3, and 5...)
U-) ; if i == 0
U({]) : } while(a != r0){
? print('debug')
-( a-- (effectively)
}
U dont worry about it
U+O i++
[]]E go to code block 2*i
with the new i value
: }else{
R-O i--
U[ r2 = a
UO a = b
]O b = b + r2
UO dont worry about it
[]]+E go to code block 2*i+1
with these new values
. end code block
all those parts where i say not to worry about it are just things that have to do with the specific ways im shuffling values around on the queue, and it would take up too much space to explain while not adding much clarity. Like and subscribe
Headass, 27 bytes + 7 byte footer, outputs numerically
U+O[]]E.U)UP:R-OU^[U]ODONE.
Footer:
UODONOE
This one doesn't score as well, but overall it is much shorter and actually outputs numerically rather than with debug messages, so I thought it'd be worth including here.
Try It Online!, Try It Online!x2, Try It Online!x3, Try It Online!x4, Try It Online!x5, Try It Online!x6
Explanation:
Overall strategy: iterate through all of the even code blocks to count how many copies there are, ending up at the footer, which then uses this count to initialize a loop on code block 1 which just gets fib(n) in a normal way. I want to believe it's possible to have something similar to this with no header/footer, but I don't have any ideas for that yet.
U+O[]]E. code block 0 (and 2, and 4...)
U+O if i exists, i++, else let i = 1
[]]E go to code block 2*i
. end code block
UODONOE code block 2*(number of copies + 1)
UO save i on the queue
DO a=0
NO b=1
E go to code block b (1)
U)UP:R-OU^[U]ODONE. code block 1
U) : NE while(i){
R-O i--
U^ r1 = a
[ r2 = a
U]O a = b + r2
DO b = r1
NE } (go to code block 1)
UP print a
. end code block
(a,b)=>a
outputted 1,(a,b)=>a(a,b)=>a
outputted 2, etc. would that be okay? Or should it be a full program \$\endgroup\$