| Bytes | Lang | Time | Link |
|---|---|---|---|
| 007 | 9 bytes | 250225T160217Z | bob bob |
| 008 | 12 bytes | 160807T061334Z | Quelklef |
| nan | Here is my attempt. After doing it | 160207T190300Z | Satic Ac |
| 015 | 18 bytes | 150825T115731Z | CoffeeCl |
| 012 | Command count | 150825T072206Z | spidersa |
| nan | 150810T164826Z | BrainSte |
9 bytes, 7 points
+[->[.]+]
Probably not the smallest but it does search for it (it prints the value of the first non 0 cell forever)
12 bytes, 8 points
+[-->>[<]<+]
- Does not change the non-0 cell value
- Does not work if the non-0 cell is the 1st or 2nd cell
- Stops on the second cell before the non-0 cell (e.g.
[][][pointer][][non-0][][])
or...
+[-->>[<]<+]>> (14b 9pts) which will stop on the non-0 cell
Here is my attempt. After doing it, I see that it is similar to other entries.
+[-[[-]>-<]>+]< has 15 commands not including part that puts number in memory
does not maintain original value
stops at P for value 1~254
stops at P-1 for value = 255
18 bytes, 15 points
>+[>[<-]<[->+<]>]>
Code requires to have at least two 0s before searched value. It finds any number, even -1 and doesn't change it.
Command count: 12
Golf score: 10
+[-[<-<]>+]>
This is my first attempt for a Brainfuck program
This seems to work fine. the program was inspired from the answer of Brainsteel(Though seems to be highly optimized and hardly the same program)
My first attempt(Without brainsteels answer also it solves the negative 1 problem in brainsteel and my answer) was:
+[>[[<+>-]>]<[->+<]>]<<[->+<]>-
With Command count: 31
Golf score: 25
11 24 Points
Edit: Now, we do not change the value that is there and do not output it. This now behaves as expected for 255 as well.
+[-[[-<<+>>]<<+>>-<]>+]-<<[->>+<<]>>
This program searches for the first non-zero byte and exits. We expect the first value pointed at to be 0, and we require that the pointer be at least at cell 1 to begin with ("The program should start somewhere in fairly low memory"). Here's a little test, no funky interpreter required:
[ Search for the first non-zero cell ]
[ http://codegolf.stackexchange.com/q/54432/31054 ]
[We require moving one cell to the right from the left end ] >
[Testing code: ]
>>>>>>>>> [... any number of > ...] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[ASCII code '0'] ++++++[-<++++++++>]
<<<<<<<<< [... the same number of < ...] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
[Find it and stop: ]
+[-[[-<<+>>]<<+>>-<]>+]-<<[->>+<<]>>
>[Output, for checking: ]<
.
Example run:
~ Me$ bf f.bf
0