![]() |
|
Brainfuck - Series of Fibonacci - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: Coding (https://sinister.li/Forum-Coding--71) +--- Thread: Brainfuck - Series of Fibonacci (/Thread-Brainfuck-Series-of-Fibonacci) Pages:
1
2
|
Brainfuck - Series of Fibonacci - Slarek - 08-25-2013 Some of you might know Brainfuck, not very efficient coding language but a good brain bender. Anyway, here's an example of Brainfuck, Series of Fibonacci. How algorithm works: Code: m1 m2 m3
a b -
a+b - b
- a+b a+b+b
a+b - a+b+b
a+b a+b+b -Code. Remember to remove comments if you use standard compiler. Code: +++++ # How many times? Number will be printed: 2n+2.
>+.>+.<< # m1 = 1, m2 = 1, print them
[-> # while (m0) { m0--, ptr = m1
>[-<+>>+<] # m1 += m2, m3 += m2, m2 = 0
<[->+>+<<] # m2 += m1, m3 += m1, m1 = 0
>[-<+>] # m1 += m2, m2 = 0
>[-<+>] # m2 += m3, m3 = 0
<<.>.< # print m1 ja m2, two consecutive numbers;
<] # ptr = m0 and the end of the while }Code without comments: Code: +++++>+.>+.<<[->>[-<+>>+<]<[->+>+<<]>[-<+>]>[-<+>]<<.>.<<]You really should try this, if you want some brain bender. :Smile: RE: Brainfuck - Series of Fibonacci - noize - 09-12-2013 Did you code this? If you did I would love to see a Brainfuck tutorial. RE: Brainfuck - Series of Fibonacci - Slarek - 09-13-2013 (09-12-2013, 10:24 PM)noize Wrote: Did you code this? If you did I would love to see a Brainfuck tutorial. I'm more than happy to make one, thanks for showing intrest :Smile: RE: Brainfuck - Series of Fibonacci - noize - 09-14-2013 (09-13-2013, 04:56 AM)Slarek Wrote:(09-12-2013, 10:24 PM)noize Wrote: Did you code this? If you did I would love to see a Brainfuck tutorial. Thanks to you to be the one that learned Brainfuck. Please, let me know when you release it. RE: Brainfuck - Series of Fibonacci - Slarek - 09-15-2013 (09-14-2013, 10:11 PM)noize Wrote:(09-13-2013, 04:56 AM)Slarek Wrote:(09-12-2013, 10:24 PM)noize Wrote: Did you code this? If you did I would love to see a Brainfuck tutorial. Actually I will publish it today:Smile: RE: Brainfuck - Series of Fibonacci - ArkPhaze - 11-05-2013 Here's an implementation of the fibonacci sequence in J; Code: f=:(-&2 +&$: <:)^:(1&<)&|**^>:
f i.10+1Output: Code: 0 1 1 2 3 5 8 13 21 34 55![]() I can grab every second fibonacci number for instance as well with very small manipulation: Code: fibx=:(-&2 +&$: <:)^:(1&<)&|**^>:
fibx 2 */ (i.10+1)Code: 0 1 3 8 21 55 144 377 987 2584 6765I love minimal languages! RE: Brainfuck - Series of Fibonacci - Slarek - 11-05-2013 (11-05-2013, 05:44 AM)ArkPhaze Wrote: Here's an implementation of the fibonacci sequence in J; Nice. I've never actually programmed in J nor read anything about it. I shall go and check it RE: Brainfuck - Series of Fibonacci - chmod - 11-05-2013 (11-05-2013, 05:44 AM)ArkPhaze Wrote: Here's an implementation of the fibonacci sequence in J; All I see is a series of emoticons lol, for me at least these two languages are very difficult to understand. RE: Brainfuck - Series of Fibonacci - Slarek - 11-05-2013 (11-05-2013, 04:02 PM)chmod Wrote:(11-05-2013, 05:44 AM)ArkPhaze Wrote: Here's an implementation of the fibonacci sequence in J; Yeah. I haven't checked the J yet but Brainfuck is simple. But you can't accomplish anything with just a small amount of code RE: Brainfuck - Series of Fibonacci - chmod - 11-05-2013 (11-05-2013, 04:11 PM)Slarek Wrote:(11-05-2013, 04:02 PM)chmod Wrote:(11-05-2013, 05:44 AM)ArkPhaze Wrote: Here's an implementation of the fibonacci sequence in J; Yeah the code is small but to look at it doesn't make much sense or at least not to me I will read your brainfuck tutorial later on. |