diff options
author | Case Duckworth | 2022-06-08 10:49:02 -0500 |
---|---|---|
committer | Case Duckworth | 2022-06-08 10:50:26 -0500 |
commit | 74d106265b3e0e07c0db5e062741208575b0098f (patch) | |
tree | 0633a15883b831a645db5ad9cf382156eab56922 /fucktrain | |
parent | Add Emacs magic comment (diff) | |
download | trainfuck-74d106265b3e0e07c0db5e062741208575b0098f.tar.gz trainfuck-74d106265b3e0e07c0db5e062741208575b0098f.zip |
Add fucktrain
Now you can turn your brainfuck programs into trainfuck!!!
Diffstat (limited to 'fucktrain')
-rwxr-xr-x | fucktrain | 35 |
1 files changed, 35 insertions, 0 deletions
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 | } | ||