- Edited
I coded this yesterday for AUB rally paper 204. I'll ask if I can get my code back in a bit.
Note: they want to input a number from 0 to 999, not a single integer.
Note: they want to input a number from 0 to 999, not a single integer.
Not exactly. You need to go back to cell 1 before closing the bracket.,[-<++>>+>+] i start by emptying cell 1, moving n to cells 2 and 3, at cell 30000 i'll have 2n to be used later for substraction
[
-
<++
>>+
>+
<< # that's the part you're missing.
]
The rest of the reasoning looks legit up front but I have to read it closer.,[-<++>>+>+<<]>[->[->+<<<+>>][+>-<]<]<<[->+++<]>[-<+>]<<[->-<]>+++++++++
There are two solutions for removing the limit from 255. You can either have a something like:Joe wroteI still struggle to manipulate numbers higher than 255. However assuming very low numbers (like 1 and 2), this is actually a good exercise. I think Johnaudi meant single digit.
@NuclearVision: I don't think your code works. Maybe you miscopied part of it? Why would you start going to the left when you're in cell0?
>[-]+[[-]>[-],[+[-----------[>[-]++++++[<------>-]<--<<[->>++++++++++<<]>>[-<<+>>]<+>]]]<]
<[>+>+<<-]>[>[>+>+<<-]>>[<<+>>-]<<<-]
>>>+++<[>[>+>+<<-]>>[<<+>>-]<<<-]++>>
[>+<-]<[-]<<[>[>+>+<<-]>>[<<+>>-]<<<-]>>[>>-<<-]>>+++++++++[>>+>+<<<-]>>>
[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>
[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]
Note: You must use a 32Bit cell size for it to work for numbers bigger than 9.the definition of ',' is to read a single byte from stdin and store it in the current cell.NuclearVision wroteis , subject to loop? was thinking of something like [,] until empty.
>,[>]
This is a simplified version:It's a bit too late, the results of the Rally were announced on Monday. But yeah, your team (204) was one of the teams who got it correct.Johnaudi wrote@Ra8 if you've corrected my code, note that I had "Use 32 bits on copy.sh/brainfuck" commented - which is a stupid move from me because there's a "dot" in that comment.