diff options
-rw-r--r-- | README.md | 3 | ||||
-rwxr-xr-x | fucktrain | 35 |
2 files changed, 38 insertions, 0 deletions
diff --git a/README.md b/README.md index 957af04..cb84572 100644 --- a/README.md +++ b/README.md | |||
@@ -37,6 +37,9 @@ because fuck you, that's why. | |||
37 | trainfuck FILE | BRAINFUCK_INTERPRETER | 37 | trainfuck FILE | BRAINFUCK_INTERPRETER |
38 | ``` | 38 | ``` |
39 | 39 | ||
40 | **NEW**: `fucktrain`, which transpiles brainfuck programs into trainfuck | ||
41 | programs! Now it's *even easier* to trainfuck!! | ||
42 | |||
40 | ## INSTALL | 43 | ## INSTALL |
41 | 44 | ||
42 | ``` | 45 | ``` |
diff --git a/fucktrain b/fucktrain new file mode 100755 index 0000000..c93a708 --- /dev/null +++ b/fucktrain | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/bin/awk -f | ||
2 | # FUCKTRAIN: FUCKAMUTHA CHOO CHOO -*- awk -*- | ||
3 | # Author: Case Duckworth <acdw@acdw.net> | ||
4 | # License: WTFPL | ||
5 | # Version: #9 | ||
6 | BEGIN { | ||
7 | print "ALL ABOARD" | ||
8 | } | ||
9 | |||
10 | { | ||
11 | gsub(/[^-+<>.,\[\]]/, "", $0) | ||
12 | gsub(/+/, "chug ", $0) | ||
13 | gsub(/-/, "chugga ", $0) | ||
14 | gsub(/>/, "choo\n", $0) | ||
15 | gsub(/</, "choo choo\n", $0) | ||
16 | gsub(/\./, clicketyClick(), $0) | ||
17 | gsub(/,/, "clack ", $0) | ||
18 | gsub(/\[/, "tickets please ", $0) | ||
19 | gsub(/\]/, "your ticket please ", $0) | ||
20 | |||
21 | } | ||
22 | |||
23 | END { | ||
24 | print "END OF THE LINE" | ||
25 | } | ||
26 | |||
27 | |||
28 | function clicketyClick() | ||
29 | { | ||
30 | if (rand() <= 0.5) { | ||
31 | return "click" | ||
32 | } else { | ||
33 | return "clickety" | ||
34 | } | ||
35 | } | ||