Commit f853114543c784ac530d48e784b2c71f8bac812b
0 parents
Exists in
master
wow
Showing 4 changed files with 67 additions and 0 deletions Side-by-side Diff
LICENSE
View file @
f853114
... | ... | @@ -0,0 +1,13 @@ |
1 | + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
2 | + Version 2, December 2004 | |
3 | + | |
4 | +Copyright (C) 2013 | |
5 | + | |
6 | +Everyone is permitted to copy and distribute verbatim or modified | |
7 | +copies of this license document, and changing it is allowed as long | |
8 | +as the name is changed. | |
9 | + | |
10 | + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
11 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
12 | + | |
13 | +0. You just DO WHAT THE FUCK YOU WANT TO. |
Makefile
View file @
f853114
README
View file @
f853114
... | ... | @@ -0,0 +1 @@ |
1 | +Converts text to Brainfuck! (Still too unoptimized) |
bfstring.c
View file @
f853114
... | ... | @@ -0,0 +1,46 @@ |
1 | +/* | |
2 | + * BRAIN FUCK CONVERTER SHIT | |
3 | + * | |
4 | + * TODO: have separate "sections" for upper case, lower case, certain | |
5 | + * symbols | |
6 | + * | |
7 | + * Have "looping" to avoid spitting out too many ++++++++'s or ------'s IF | |
8 | + * IT SAVES SPACE. | |
9 | + */ | |
10 | +#include <stdio.h> | |
11 | + | |
12 | +int | |
13 | +main(int argc, char *argv[]) | |
14 | +{ | |
15 | + int curv = 120, curc; | |
16 | + | |
17 | + /* store space (32) in second element */ | |
18 | + printf("++++[>++++++++<-]>"); | |
19 | + | |
20 | + /* set first cell thing to 120 */ | |
21 | + printf(">++++++++++[<<++++++++++++>>-]<<"); | |
22 | + | |
23 | + while ((curc = getchar()) != EOF) { | |
24 | + | |
25 | + if (curc == ' ') { | |
26 | + printf(">.<"); | |
27 | + continue; | |
28 | + } | |
29 | + | |
30 | + while (curv != curc) { | |
31 | + if (curv < curc) { | |
32 | + curv++; | |
33 | + putchar('+'); | |
34 | + } else { | |
35 | + curv--; | |
36 | + putchar('-'); | |
37 | + } | |
38 | + } | |
39 | + | |
40 | + putchar('.'); | |
41 | + } | |
42 | + // >.< <.> >.> <.< | |
43 | + | |
44 | + putchar('\n'); | |
45 | + return 0; | |
46 | +} |