-
Notifications
You must be signed in to change notification settings - Fork 0
/
ascii.zp
98 lines (88 loc) · 3.35 KB
/
ascii.zp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
(module "ascii"
(export
(list "cowsay" cowsay)
(list "standard-fish" standard-fish)
(list "non-standard-fish" non-standard-fish)
(list "smiley" smiley))
(cow-interpolate-fill (lambda (l what)
(if (< l 30)
(cow-interpolate-fill (add1 l) (string:append what " "))
what)))
(cow-good-substring (lambda (what)
(let ((l (sub1 (string:length what)))
(x (string:last what)))
(if (> (string:find what #\space) -1)
(if (char=? x #\space)
what
(cow-good-substring (substring what 0 l)))
what))))
(cow-interpolate (lambda (what)
(let* ((x (cow-good-substring (substring what 0 30)))
(l (string:length what))
(xl (string:length x)))
(if (> l 30)
(++ "| " (cow-interpolate-fill xl x) " |\n" (cow-interpolate (substring what xl l)))
(++ "| " (cow-interpolate-fill l what) " |\n")))))
(cowsay (lambda (what)
(begin
(display " ___________________________________\n")
(display "/ \\\n")
(display (cow-interpolate (string:substitute what "\n" " ")))
(display "\\ /\n")
(display " -----------------------------------\n")
(display " \\ ^__^\n")
(display " \\ (oo)\\_______\n")
(display " (__)\\ )\\/\\\n")
(display " ||----w |\n")
(display " || ||"))))
(smiley (lambda ()
(begin
(display " .-'\"\"\"\"\"'-.\n")
(display " .' `.\n")
(display " / o o \\\n")
(display ": :\n")
(display "| |\n")
(display ": \\ / :\n")
(display " \\ `.____.' /\n")
(display " `. .'\n")
(display " `-._____.-'"))))
(left-fish (lambda ()
(begin
(display " _J\"\"-.\n")
(display "/o ) \\ ,';\n")
(display "\\ ,' ; /\n")
(display " \"-.__.'\"\\_;"))))
(right-fish (lambda ()
(begin
(display " .-\"\"L_\n")
(display ";`, / ( o\\\n")
(display "\\ ; `, \/\n")
(display ";_/\"`.__.-\""))))
(fish-bubbles (lambda ()
(begin
(display " o O\n")
(display " .-\"\"L_ O o\n")
(display ";`, / ( o\\ o\n")
(display "\\ ; `, \/\n")
(display ";_/\"`.__.-\""))))
(standard-fish (lambda direction
(cond ((or (null? direction) (eq? (car direction) :left)) (left-fish))
((eq? (car direction) :right) (right-fish))
((eq? (car direction) :bubbles) (fish-bubbles))
(else (display (list "Unrecognized option: " direction))))))
(non-standard-fish (lambda ()
"The goose was found on http://www.retrojunkie.com/asciiart/animals/ducks.htm"
(begin
(display " __\n")
(display " /` ,\\__\n")
(display " | ).-'\n")
(display " / .--'\n")
(display " / /\n")
(display " , _.==''` \\\n")
(display " .'( _.=' |\n")
(display " { `` _.=' |\n")
(display " { \\` ; /\n")
(display " `. `'=..' .='\n")
(display " `=._ .='\n")
(display " jgs '-`\\\\`__\n")
(display " `-._{\n")))))