• Coding
  • Write a brainfuck program

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?
There are two solutions for removing the limit from 255. You can either have a something like:
[0],[1],[2]
0,3,42

[0] is pointer 0, and has the value of 0.
In [1] you have the value 3, which is in definition, 3 times 255, and in [2] you have 42, so in total the number is: 3*255 + 42 = 802.
Once [1] reaches the limit (255++ == 0) then [0] will have a value added to it.

The other (easier) solution, most compilers (such as http://copy.sh/brainfuck ) have an option to where you can adjust the cell size from 8 Bits (255) to 32 bits.
@Johnaudi, yes you need to set some sort of integer system based on fixed cell sizes. But that doesn't even come close to solving the issue of input. "," by definition accepts one byte of input, which makes it difficult to enter any larger number. I'm still unclear how to deal with this.

Changing the cell size to 4bytes sounds like a good solution to the problem, but not being standard brainfuck it won't run on standard compilers.
is , subject to loop? was thinking of something like [,] until empty.
There's the code answering your question: (3n^2 -2n +9)
>[-]+[[-]>[-],[+[-----------[>[-]++++++[<------>-]<--<<[->>++++++++++<<]>>[-<<+>>]<+>]]]<]
<[>+>+<<-]>[>[>+>+<<-]>>[<<+>>-]<<<-]
>>>+++<[>[>+>+<<-]>>[<<+>>-]<<<-]++>>
[>+<-]<[-]<<[>[>+>+<<-]>>[<<+>>-]<<<-]>>[>>-<<-]>>+++++++++[>>+>+<<<-]>>>
[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>
[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]
Note: You must use a 32Bit cell size for it to work for numbers bigger than 9.
NuclearVision wroteis , subject to loop? was thinking of something like [,] until empty.
the definition of ',' is to read a single byte from stdin and store it in the current cell.

I don't know how common implemetations behave, but the definition doesn't read the whole stdin.
I was one of the problem setters in the AUB Rally Paper. I set this problem and corrected it. More than half the teams were able to do it correctly!
Well, to read the whole stdin, you should do something like: ,[>,] this will read all the characters in stdin until we read the \0 character which its value is 0 so the loop will terminate.
do you mean ,[->+<,] but again how would the second cell fit the excess of 1 byte.
@Ra8 but then how will you now the size (in cell count) of your number?
You don't need to know the size of the input per say:
If we do:
>,[>]
This is a simplified version:
Each digit will be in a cell, so for example reading the input 123, your memory will look like this: 0 49 50 51 0, and the tape will be pointing at the 5th cell. All you have to do now is deduct 48 from each of the non zero cells to get the actual integer value.
After that you have to multiply and add the right most by 1, then by 1*10, then by 1*10*10 etc.. until you reach the 0.

After reaching 0 49 50 51 0, you can go back to the first cell (49) by doing <[<]>, you don't actually need to know how many cells are occupied.

Check @JohnAudi's code first line he did something similar
@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.
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.
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.