Changeset 60 for trunk/Examples
- Timestamp:
- Dec 3, 2014, 10:45:24 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Examples/Fibonacci_comments.b
r41 r60 1 +++++++++++ number of digits to output 2 > #1 3 + initial number 4 >>>> #5 5 ++++++++++++++++++++++++++++++++++++++++++++ (comma) 6 > #6 7 ++++++++++++++++++++++++++++++++ (space) 8 <<<<<< #0 9 [ 10 > #1 11 copy #1 to #7 12 [>>>>>>+>+<<<<<<<-]>>>>>>>[<<<<<<<+>>>>>>>-] 13 14 < 15 divide #7 by 10 (begins in #7) 16 [ 17 > 18 ++++++++++ set the divisor #8 19 [ 20 subtract from the dividend and divisor 21 -<- 22 if dividend reaches zero break out 23 copy dividend to #9 24 [>>+>+<<<-]>>>[<<<+>>>-] 25 set #10 26 + 27 if #9 clear #10 28 <[>[-]<[-]] 29 if #10 move remaining divisor to #11 30 >[<<[>>>+<<<-]>>[-]] 31 jump back to #8 (divisor possition) 32 << 33 ] 34 if #11 is empty (no remainder) increment the quotient #12 35 >>> #11 36 copy to #13 37 [>>+>+<<<-]>>>[<<<+>>>-] 38 set #14 39 + 40 if #13 clear #14 41 <[>[-]<[-]] 42 if #14 increment quotient 43 >[<<+>>[-]] 44 <<<<<<< #7 45 ] 46 47 quotient is in #12 and remainder is in #11 48 >>>>> #12 49 if #12 output value plus offset to ascii 0 50 [++++++++++++++++++++++++++++++++++++++++++++++++.[-]] 51 subtract #11 from 10 52 ++++++++++ #12 is now 10 53 < #11 54 [->-<] 55 > #12 56 output #12 even if it's zero 57 ++++++++++++++++++++++++++++++++++++++++++++++++.[-] 58 <<<<<<<<<<< #1 59 60 check for final number 61 copy #0 to #3 62 <[>>>+>+<<<<-]>>>>[<<<<+>>>>-] 63 <- #3 64 if #3 output (comma) and (space) 65 [>>.>.<<<[-]] 66 << #1 67 68 [>>+>+<<<-]>>>[<<<+>>>-]<<[<+>-]>[<+>-]<<<- 69 ] 1 [ This program prints Sierpinski triangle on 80-column display. ] 2 > 3 + + 4 + + 5 [ < + + 6 j + + 7 + + + + 8 > - ] > 9 + + + + + + + + 10 [ > 11 + + + + 12 < - ] > 13 > + + > > > + > 14 > > + < 15 < < < < < < < < 16 < [ - [ - > + < 17 ] > [ - < + > > > . < < ] > > > 18 [ [ 19 - > + + 20 + + + + 21 + + [ > + + + + 22 < - ] > 23 . < < [ - > + < 24 ] + > [ - > + + 25 + + + + + + + + < < + > ] > . [ 26 - ] > ] 27 ] + < < < [ - [ 28 - > + < ] + > [ 29 - < + > > > - [ - > + < ] + + > 30 [ - < - > ] < < 31 < ] < < < < ] + + + + + + + + + 32 + . + + + . [ - ] < ] + + + + + 33 * * * * * M a d e * B y : * N Y Y R I K K I * 2 0 0 2 * * * * *
Note:
See TracChangeset
for help on using the changeset viewer.