Ferrous Moon
http://www.ferrousmoon.com:80/forums/

Thoughts on brainfsck?
http://www.ferrousmoon.com:80/forums/viewtopic.php?f=45&t=1565
Page 1 of 1

Author:  Chase [Sat Nov 01, 2008 2:32 am ]
Post subject:  Thoughts on brainfsck?

I have been using this language for awhile now just due to how interesting I find it. What do you think of it.
It is a turing complete language with only 8 commands: [],.<>+-

Example of code in brainfsck, placing 128 in cell 1, 32 in cell 2, placing 48 in cell 3 and dividing cell 1 by cell 2 and placing the result in cell 1 ( ergo 8 ), then adding cell 3 to cell 1, and printing cell 1 ( which will print out the answer, ergo 8 ):
Code:
++++[>>++++[<++++++++>-]<<-]>>>++++[<++++>-]>++++++[<++++++++>-][-]>[-]>[-]>[-]<<<<<<[>>>+<<<-]>>>[<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<[>+<<-[>>[-]>+<<<-]>>>[<<<+>>>-]<[<-[<<<<->>>>[-]]+>-]<-]<<<<+>>>]<[<<+>>>+<-]>[<+>-]<<<.
It does use a few temporary cells during the division (actually 4 of them), incase your trying to follow the flow of the code. I could program up a copy that uses 16 bit ( 0 - 65535 ) values instead of the 8 bit ( 0 - 255 ) ones. But that program would be a quite a bit longer.


EDIT:

Here, I fixed it so you can see where I add the two numbers up (cell 1 and 2) theya re followed by an !, and I also made it so it can print out if the answer is more then 1 digit long (max of 3)
Code:
++++[>>++++[<++++++++>-]<<-]>!>>++++[<++++>-]<!>>++++++[<++++++++>-][-]>[-]>[-]>[-]<<<<<<[>>>+<<<-]>>>[<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-]<[>+<<-[>>[-]>+<<<-]>>>[<<<+>>>-]<[<-[<<<<->>>>[-]]+>-]<-]<<<<+>>>][-]>[-]<<<<[>>>+>+<<<<-]>>>>[<<<<+>>>>-][-]>[-]<<<<<[>>>>+>+<<<<<-]>>>>>[<<<<<+>>>>>-]++++++++++>[-]>[-]>[-]>[-]<<<<<<[>>>+<<<-]>>>[<[>>+>+<<<-]>>>[<<<+>>>-]<[>+<<-[>>[-]>+<<<-]>>>[<<<+>>>-]<[<-[<<<<->>>>[-]]+>-]<-]<<<<+>>>][-]>[-]<<[>+>+<<-]>>[<<+>>-][-]>[-]<<<[>>>+<<<-]>>>[<<[<+>>+<-]>[<+>-]>-]<<[-][-]>[-]>[-]>[-]<<<<<[>>+<<-]>>[<[>>+>+<<<-]>>>[<<<+>>>-]<[>+<<-[>>[-]>+<<<-]>>>[<<<+>>>-]<[<-[<<<->>>[-]]+>-]<-]<<<+>>]<<<[<<<->>>>>>+<<<-]>>>[<<<+>>>-]<<[<<<<->>>>>>+<<-]>>[<<+>>-]<<<<[<<+>>>>>>+<<<<-]>>>>[<<<<+>>>>-]<<<<[>+>>>>+<<<<<-]>>>>>[<<<<<+>>>>>-]<<<<<[>>+>>>>+<<<<<<-]>>>>>>[<<<<<<+>>>>>>-]<<<<.<.<<<.
EDIT2: Forgot to fix the 1 digit spot if greater then 10, I changed the code above.

EDIT?: Actually its still wring, but to tired to try and debug it. (its like midnight here). Yes I am currently staying in Akibara district or something, bouncing off my home machine for english internet (otherwise all I get are alot japanese sites (more annoying then it seems)).

EDIT?: Sorry was just informed that doesn't make sense, I mean I am using my computer at home in the USA as a proxy for um, my surfing needs, and google and stuff I type in here automatically redirects me to japanese language, and I can't read japanese that well.

Author:  Miah [Sat Nov 01, 2008 1:09 pm ]
Post subject:  Re: Thoughts on brainfsck?

Use a different DNS.

I use one in Los Angeles, since my ISP sucks a lot. Sometimes it fails to resolve such basic things as gmail.com.

Author:  Chase [Sat Nov 01, 2008 8:51 pm ]
Post subject:  Re: Thoughts on brainfsck?

Actually I am about to board my flight home, and i'm not lucky enough to get a flight with inflight wifi. So see you in about 18 hours. I am very glad I didn't have to pay the trip here and back. (it was like 8g roundtrip for just me). I got a new laptop :) (I left mine old one at home due to luggage space issues).

Anyway, I really wanna know your thoughts on brainfsck. Mostly because it is like a very basic form of asm to me (which is cool).

Author:  eddieringle [Sun Nov 02, 2008 11:50 am ]
Post subject:  Re: Thoughts on brainfsck?

My thoughts?

Ow.

Author:  Miah [Sun Nov 02, 2008 12:59 pm ]
Post subject:  Re: Thoughts on brainfsck?

Brainfsck is a toy, nothing more. Originally built as a proof of concept; what can be done with very little.

In truth, everything can be done with BF, but very very slowly. I could also reasonably do all of my coding in logic gate form, but doing so doesn't make a lot of sense either. The expanded assembly instruction sets mean that we can do a lot more in a lot less time. Using BF over other languages defeats this purpose.

Though, I suppose, it might be one of those things that you want to experience if you wanted to know how difficult coding was. By "was" I mean the times that there was only RAM, no OS, you had to input everything manually with switches, and losing power or flipping a wrong switch meant doing it all over again.

Or using wires to program, much like the ENIAC (which was the first digital computer ever. Incidentally, the inventor specced out an idea that could have been the first internet iteration; it just didn't end up that way).

Just because you can do it doesn't mean it's practical. Unless you're doing it to kill time, there's not a lot of other reason.

Author:  Chase [Sun Nov 02, 2008 10:18 pm ]
Post subject:  Re: Thoughts on brainfsck?

No, its not practical. But learning to do division, multiplication, etc etc, with only loops and iterations is very interesting. I have a part of a bf psudo-c compiler, that compiles a psudo-c style language to bf. Only painful part is preforming bitwidth conversions (multi-cell) and the instruction seperation, due to bf's limitations. But I did the above by hand (otherwise it would of come out correctly). I just find bf interesting because of just how low level it is. I am still working on practical ways to do bitwise and bitshift operations.

Author:  Rickton [Sun Nov 02, 2008 10:47 pm ]
Post subject:  Re: Thoughts on brainfsck?

My brain is fucked.

Author:  gamers2000 [Sun Jan 18, 2009 5:15 am ]
Post subject:  Re: Thoughts on brainfsck?

Ouch.

That is something I am NOT touching with a ten foot pole.

That, and Whitespace.

EDIT: Then again,whitespace might be fun. Imagine including riddles in whitespace in forum posts. Sounds like something up Miah's alley.

Author:  prophile [Sun Jan 18, 2009 9:31 am ]
Post subject:  Re: Thoughts on brainfsck?

Just because it's turing-complete doesn't mean it's useful.

Author:  FinalWarrior [Sun Jan 18, 2009 1:08 pm ]
Post subject:  Re: Thoughts on brainfsck?

Brainfuck is Ada Lovelace's bitch. :mrgreen:

Anyhow, I have enough trouble recalling C++ while learning Java, I don't expect to be understanding anything Brainfuck-y any time soon. v.v

-- Griffinhart

Page 1 of 1 All times are UTC-05:00
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/