Last change
on this file was 11, checked in by chronos, 12 years ago |
- Added: Some other examples from web.
|
File size:
1007 bytes
|
Line | |
---|
1 | ; puts.rbf - print some brainfuck code for a given string (print + clear)
|
---|
2 | ;
|
---|
3 | ; Dean Scarff's brain was last raped 27 July 2003.
|
---|
4 | ;
|
---|
5 | ; <Rich BrainFuck source file>
|
---|
6 | ; To extract pure brainfuck source (and format it as well!):
|
---|
7 | ; sed -e 's/;.*//' puts.rbf | tr -d '[:space:]' \
|
---|
8 | ; | sed -e 's/\(.\{80\}\)/\1\n/g' > puts.bf
|
---|
9 | ;
|
---|
10 | ; Some usage examples:
|
---|
11 | ; $ echo "My string" | bfi puts.bf > mystring.bf
|
---|
12 | ;
|
---|
13 | ; $ bfi puts # Then just type, hit Ctrl+D twice or ÿ when done
|
---|
14 | ;
|
---|
15 |
|
---|
16 | ; *** Initialize increment and print output registers ***
|
---|
17 | ->++; a[0] = -1; a[1] = 2;
|
---|
18 | >>+++++++++++; a[3] = 11; p = 3;
|
---|
19 | [<++++[<+<+>>-]>-]<; a[0], a[1] += 4 * a[3]; a[3] = 0; p = 2;
|
---|
20 |
|
---|
21 | ; *** Read a character ***
|
---|
22 | ,+[-; if input != EOF (or ÿ)
|
---|
23 |
|
---|
24 | ; *** Print "increment and print" sequence ***
|
---|
25 | [<<.>>-]<.>; print ("+" x a[2] "."); a[2] = 0;
|
---|
26 |
|
---|
27 | ; *** Initialize clear output ***
|
---|
28 | >>+++++++++; a[4] = 9; p = 4;
|
---|
29 | [[<+<++>>-]<[>+<-]>-]<<+; a[2] = 91; p = 2;
|
---|
30 |
|
---|
31 | ; Print "clear" sequence
|
---|
32 | .<-.+>++.; print ("[-]");
|
---|
33 |
|
---|
34 | [-],+]; cleanup, loop
|
---|
Note:
See
TracBrowser
for help on using the repository browser.