File tree Expand file tree Collapse file tree 5 files changed +58
-15
lines changed
Expand file tree Collapse file tree 5 files changed +58
-15
lines changed Original file line number Diff line number Diff line change 1+ if (item == * "+" ){
2+ sprintf (cells [pos ], atoi (cells [pos ])+ 1 );
3+ }
4+ if (item == * "-" ){
5+ sprintf (cells [pos ], atoi (cells [pos ])- 1 );
6+ }
7+ if (item == * ">" ){
8+ pos ++ ;
9+ }
10+ if (item == * "<" ){
11+ pos -- ;
12+ }
13+ if (item == * "." ){
14+ printf ("%s" , cells [pos ]);
15+ }
16+ if (item == * "," ){
17+ }
18+
Original file line number Diff line number Diff line change 1+ HOW TO BRAINFUCK 101?
2+
3+ Brainfuck is an esoteric language, that is turing-complete and works with cells. It has 8 instructions, and those are:
4+
5+ + --> Modifies the cell value it is on by 1.
6+
7+ - --> Modifies the cell value it is on by -1.
8+
9+ > --> changes the cell it acts on by 1.
10+
11+ < --> Changes the cell it acts on by -1.
12+
13+ , --> Allows for data input.
14+
15+ . --> Echoes the value of the cell it ends on.
16+
17+ [ --> Starts a loop.
18+
19+ ] --> Goes to the las open loop it the cell it ends on does not have the value 0 / null.
Original file line number Diff line number Diff line change 1+ COMO PROGRAMAR EN BRAINFUCK 101?
2+
3+ Brainfuck es un lenguaje esoterico, el cual es turing completo y funciona con celdas. Tiene 8 instrucciones, las cuales son:
4+
5+ + --> Modifica el valor de la celda en la que está por 1.
6+
7+ - --> Modifica el valor de la celda en la que está por -1.
8+
9+ > --> Cambia la celda en la que actua por 1.
10+
11+ < --> Cambia la celda en la que actua por -1.
12+
13+ , --> Permite la introducción de datos.
14+
15+ . --> Expulsa el valor de la celda en la que está.
16+
17+ [ --> Comienza un bucle.
18+
19+ ] --> Vuelve al último bucle abierto si en la celda en la que acaba no tiene el valor 0 / null.
Original file line number Diff line number Diff line change 11#include <stdio.h>
22#include <string.h>
3+ #include "../headers/brainfutils.h"
34
45/*
56 * How does brainfuck work?
@@ -40,21 +41,7 @@ int main(int argc, char *argv[]){
4041 }
4142
4243 // Read the character and perform an action based on it
43- if (script [progress ]== * "+" ){
44- sprintf (cells [pos ], atoi (cells [pos ])+ 1 );
45- }
46- if (script [progress ]== * "-" ){
47- sprintf (cells [pos ], atoi (cells [pos ])- 1 );
48- }
49- if (script [progress ]== * ">" ){
50- pos ++ ;
51- }
52- if (script [progress ]== * "<" ){
53- pos -- ;
54- }
55- if (script [progress ]== * "." ){
56- printf ("%s" , cells [pos ]);
57- }
44+ #include "../headers/brainfutils.h"
5845 progress ++ ;
5946 }while (1 );
6047 printf ("Error: %s" , error );
You can’t perform that action at this time.
0 commit comments