about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-06-08 10:49:02 -0500
committerCase Duckworth2022-06-08 10:50:26 -0500
commit74d106265b3e0e07c0db5e062741208575b0098f (patch)
tree0633a15883b831a645db5ad9cf382156eab56922
parentAdd Emacs magic comment (diff)
downloadtrainfuck-74d106265b3e0e07c0db5e062741208575b0098f.tar.gz
trainfuck-74d106265b3e0e07c0db5e062741208575b0098f.zip
Add fucktrain
Now you can turn your brainfuck programs into trainfuck!!!
-rw-r--r--README.md3
-rwxr-xr-xfucktrain35
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.
37trainfuck FILE | BRAINFUCK_INTERPRETER 37trainfuck FILE | BRAINFUCK_INTERPRETER
38``` 38```
39 39
40**NEW**: `fucktrain`, which transpiles brainfuck programs into trainfuck
41programs! 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
6BEGIN {
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 print
21}
22
23END {
24 print "END OF THE LINE"
25}
26
27
28function clicketyClick()
29{
30 if (rand() <= 0.5) {
31 return "click"
32 } else {
33 return "clickety"
34 }
35}