Jump to content
xisto Community
Sign in to follow this  
qwijibow

Brainf*ck - World's Smallest And Hardest Language

Recommended Posts

Ahhh.. okay i understand...for simplicity, i just make sure not to use BF code in comments..i use SUB for '-' and ADD for '+'.great language though !makes me want to attempt to learn assembly.... again !

Share this post


Link to post
Share on other sites

This language is very complicated considering the minimal amount of commands. I greatly admire anyone who takes the time to use it on complex programs. Even simple programs for that matter. Are there many games written in it? Does anyone know where i try some out?

Share this post


Link to post
Share on other sites

This language is very complicated considering the minimal amount of commands. I greatly admire anyone who takes the time to use it on complex programs. Even simple programs for that matter. Are there many games written in it? Does anyone know where i try some out?

<{POST_SNAPBACK}>


No games yet. Probably the closest thing is the cellular automaton "life", here:

http://forums.xisto.com/no_longer_exists/

 

Tic-tac-toe and guess-a-number are on my to-do list, but they've been there a while.

 

The best general source for brain**** source code is the repository at:

http://forums.xisto.com/no_longer_exists/

 

(Fix censoring in both URLs.)

 

Good luck;

-Daniel Cristofani.

Share this post


Link to post
Share on other sites

No games yet. Probably the closest thing is the cellular automaton "life", here:http://forums.xisto.com/no_longer_exists/

Tic-tac-toe and guess-a-number are on my to-do list, but they've been there a while.

The best general source for brain**** source code is the repository at:
http://forums.xisto.com/no_longer_exists/

(Fix censoring in both URLs.)

Good luck;
-Daniel Cristofani.


Here is my version of a BrainF*ck compiler for DOS, 114 byte sized:

				 MOV AH,9h 				 MOV DX,EMPEZAR 				 INT 021h LEER: 				 MOV AH,8h 				 INT 021h 				 MOV DI,BFLOOP AUN_NO:		  DEC DI 				 CMP B[DI],AL 				 JE IMPRIME 				 CMP B[DI],CH 				 JNE AUN_NO 				 JMP LEER+2 IMPRIME:		 MOV DX,DI 				 INC DX 				 PUSH AX 				 MOV AH,9h 				 INT 021h 				 POP AX 				 CMP AL,040h 				 JNE LEER 				 RET EMPEZAR:		 MOV BH,80h 				 MOV CX,BX 				 MOV DI,BX 				 REP STOSB 				 DB '$',0 				 DB '>' 				 INC BX 				 DB '$' 						 DB '<' 				 DEC BX 				 DB '$' 				 DB '+' 				 INC B[BX] 				 DB '$' 				 DB '-' 				 DEC B[BX] 				 DB '$' 				 DB '.' 				 MOV AH,2 				 MOV DL,B[BX] 				 INT 021h 				 DB '$' 				 DB ',' 				 MOV AH,8 				 INT 021h 				 MOV B[BX],AL 				 DB '$' 				 DB '@' 				 INT 20h 				 DB ']' 				 RET 				 DB '$' 				 DB '[' BFLOOP:		  CALL AQUI AQUI: 				 POP SI 				 SUB SI,3h 				 PUSH SI 				 OR B[BX],CH 				 JNE FUERA 				 POP AX BUCLE:		   LODSB 				 CMP AL,0E8h 				 JNE OTRO 				 INC CX OTRO:			CMP AL,0C3h 				 JNE BUCLE 				 LOOP BUCLE 				 JMP SI FUERA:		   DB '$' 

For those who don't want to assemble this compiler of BF, here is the uuencoded version of the COM executable:

begin 644 bf.com MM`FZ)P'-(;0(S2&_5@%/.`5T!C@M=??K\(GZ0E"T"<TA6#Q`=>'#MX"+RXG? M\ZHD`#Y#)#Q+)"O^!R0M_@\D+K0"BA?-(20LM`C-(8@')$#-(%W#)%OH``!> 8@^X#5@@O=0]8K#SH=0%!/,-U]N+T_^8D ` end 


You use this compiler to generate .COM executables from BF source code. The source code must not have any character other than BF commands, and the BF program must end with the "@" character flag. For example, the random number generator above mentioned:

>>>++[<++++++++[<[<++>-]>>[>>]+>>+[-[->>+<<<[<[<<]<+>]>[>[>>]]]<[>>[-]]>[>[-<<]>[<+<]]+<<]<[>+<-]>>-]<.[-]>>]@

Then you use the compiler by writing this command line:

BF <RANDOM.BF >RANDOM.COM

And then you run RANDOM.COM to watch the result...

If you need to clean up the code, you can use my BF sourcecode cleaner (CLEAN.BF):

+[>,[>+>>+<<<-]++++++++[>--------<-]>[<<+>><+++[>+++++++<-]+>[<->[ ->+<]]<[>>>.<<<-]+>>--[<<->>[-<+>]]<<[>>>.<<<-]+>+[<->[->+<]]<[>>> .<<<-]+>>--[<<->>[-<+>]]<<[>>>.<<<-]+>>+++++++[<-->-]<[<->[->+<]]< [>>>.<<<-]+>>--[<<->>[-<+>]]<<[>>>.<<<-]+>>+++++++[<---->-]<-[<->[ ->+<]]<[>>>.<<<-]+>>--[<<->>[-<+>]]<<[>>>.<<<-]>[-]]>>[-]<<<<-]>++ ++++++[<++++++++>-]<.@ 

Then you compile CLEAN.BF into CLEAN.com:

BF <CLEAN.BF >CLEAN.COM

And then, to compile any commented BF program:

CLEAN <program.bf | BF >program.com

Try out this code:

+[->,.-------------]<[++++++++++++++.<]@

This is my Hello World in BF:

>+++++++++[<++++++++>-]<.>+++++[<++++++++>-]<-.---.>+++[<---->-]<+.[-]>+++++[<++++++>-]<++.>++++++[<+++++++>-]<+++.>+++++[<++++++++>-]<.-------.+>>>+++++[<+++++[<++++>-]>-]<<.<.>>>+++++[<++++++>-]<+++.-.<<++++.----.++++++++++.>>.<[-]>[<++>-]+++[<++++>-]<+.[-]++++[<------>-]<.>++++[<++++>-]<+.---------.++++++.[-]>++++++++[<++++++>-]<--.@

I've attached a BF debugger of my creation for debugging these BF programs (so you will understand quickly their operation.

Share this post


Link to post
Share on other sites

OMG who would seriously try to program in this language? From my perspective, it is something just for messing around with and not for anything serious. Is this even a compiled language? Or is it just interpreted (like JavaScript)?Something as simple as Hello World is at high difficulty to figure out, imagine trying to program a Snake game or any common desktop application with this language!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.