about summary refs log tree commit diff stats
path: root/fucktrain
diff options
context:
space:
mode:
authorCase Duckworth2022-06-08 10:49:02 -0500
committerCase Duckworth2022-06-08 10:50:26 -0500
commit74d106265b3e0e07c0db5e062741208575b0098f (patch)
tree0633a15883b831a645db5ad9cf382156eab56922 /fucktrain
parentAdd Emacs magic comment (diff)
downloadtrainfuck-74d106265b3e0e07c0db5e062741208575b0098f.tar.gz
trainfuck-74d106265b3e0e07c0db5e062741208575b0098f.zip
Add fucktrain
Now you can turn your brainfuck programs into trainfuck!!!
Diffstat (limited to 'fucktrain')
-rwxr-xr-xfucktrain35
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
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}