Compare commits

...

3 Commits

Author SHA1 Message Date
377c3b02b7 more fuzzed fixes 2024-03-30 20:10:41 -04:00
6aa1219f2e remove binary 2024-03-27 21:42:10 -04:00
d6a0e3d742 the implementation begins 2024-03-27 21:41:34 -04:00
147 changed files with 1658 additions and 353 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.DS_Store
./cowsay

17
cows/MechAndCow.cow Normal file
View File

@ -0,0 +1,17 @@
## OFFSET 10
$thoughts ,-----.
$thoughts | |
$thoughts ,--| |-.
__,----| | | |
,;:: | `_____' |
`._______| i^i |
`----| |---'| .
,-------._| |== ||//
| |_|P`. /'/
`-------' 'Y Y/'/'
.==\ /_\
^__^ / /'| `i
($eyes)\_______ /' / | |
(__)\ )\/\ /' / | `i
$tongue ||----w | ___,;`----'.___L_,-'`\__
|| || i_____;----\.____i""\____\

20
cows/TuxStab.cow Normal file
View File

@ -0,0 +1,20 @@
## OFFSET 8
$thoughts , ,
$thoughts /( )`
$thoughts \ \___ / |
/- _ `-/ '
(/\/ \ \ /\
/ / | ` \
O O ) / |
`-^--'`< '
.--. (_.) _ ) /
|o_o | `.___/` /
|:_/ | `-----' /
//<- \ \----. __ / __ \
(| <- | )---|====O)))==) \) /====
/'\ <- _/`\---' `--' `.__,' \
\___)=(___/ | |
\ /
______( (_ / \______
,' ,-----' | \
`--\{__________) \/

View File

@ -1,10 +1,9 @@
## ##
## Beavis, with Zen philosophy removed. ## Beavis, with Zen philosophy removed.
## ##
$the_cow = <<EOC;
$thoughts __------~~-, $thoughts __------~~-,
$thoughts ,' , $thoughts ,' ,
/ \\ / \
/ : / :
| ' | '
| | | |
@ -12,12 +11,11 @@ $the_cow = <<EOC;
| _-- | | _-- |
_| =-. .-. || _| =-. .-. ||
o|/o/ _. | o|/o/ _. |
/ ~ \\ | / ~ \ |
(____\@) ___~ | (____@) ___~ |
|_===~~~.` | |_===~~~.` |
_______.--~ | _______.--~ |
\\________ | \________ |
\\ | \ |
__/-___-- -__ __/-___-- -__
/ _ \\ / _ \
EOC

View File

@ -1,29 +1,26 @@
## ##
## Blowfish ## Blowfish
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
| . | .
. |L /| . |L /|
_ . |\\ _| \\--+._/| . _ . |\ _| \--+._/| .
/ ||\\| Y J ) / |/| ./ / ||\| Y J ) / |/| ./
J |)'( | ` F`.'/ J |)'( | ` F`.'/
-<| F __ .-< -<| F __ .-<
| / .-'. `. /-. L___ | / .-'. `. /-. L___
J \\ < \\ | | O\\|.-' J \ < \ | | O\|.-'
_J \\ .- \\/ O | | \\ |F _J \ .- \/ O | | \ |F
'-F -<_. \\ .-' `-' L__ '-F -<_. \ .-' `-' L__
__J _ _. >-' )._. |-' __J _ _. >-' )._. |-'
`-|.' /_. \\_| F `-|.' /_. \_| F
/.- . _.< /.- . _.<
/' /.' .' `\\ /' /.' .' `\
/L /' |/ _.-'-\\ /L /' |/ _.-'-\
/'J ___.---'\\| /'J ___.---'\|
|\\ .--' V | `. ` |\ .--' V | `. `
|/`. `-. `._) |/`. `-. `._)
/ .-.\\ / .-.\
VK \\ ( `\\ VK \ ( `\
`.\\ `.\
EOC

View File

@ -1,16 +1,14 @@
## ##
## A cow with a bong, from lars@csua.berkeley.edu ## A cow with a bong, from lars@csua.berkeley.edu
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
^__^ ^__^
_______/($eyes) _______/($eyes)
/\\/( /(__) /\/( /(__)
| W----|| |~| | W----|| |~|
|| || |~| ~~ || || |~| ~~
|~| ~ |~| ~
|_| o |_| o
|#|/ |#|/
_+#+_ _+#+_
EOC

View File

@ -1,12 +1,10 @@
## ##
## The Budweiser frogs ## The Budweiser frogs
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
oO)-. .-(Oo oO)-. .-(Oo
/__ _\\ /_ __\\ /__ _\ /_ __\
\\ \\( | ()~() | )/ / \ \( | ()~() | )/ /
\\__|\\ | (-___-) | /|__/ \__|\ | (-___-) | /|__/
' '--' ==`-'== '--' ' ' '--' ==`-'== '--' '
EOC

View File

@ -1,10 +1,8 @@
## ##
## A cute little wabbit ## A cute little wabbit
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts \\ $thoughts \
\\ /\\ \ /\
( ) ( )
.( o ). .( o ).
EOC

View File

@ -1,23 +1,21 @@
## ##
## The cheese from milk & cheese ## The cheese from milk & cheese
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
_____ _________ _____ _________
/ \\_/ | / \_/ |
| || | ||
| || | ||
| ###\\ /### | | | ###\ /### | |
| 0 \\/ 0 | | | 0 \/ 0 | |
/| | | /| | |
/ | < |\\ \\ / | < |\ \
| /| | | | | /| | | |
| | \\_______/ | | | | | \_______/ | | |
| | | / / | | | / /
/|| /||| /|| /|||
----------------| ----------------|
| | | | | | | |
*** *** *** ***
/___\\ /___\\ /___\ /___\
EOC

View File

@ -1,14 +1,12 @@
## ##
## A cowering cow ## A cowering cow
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
,__, | | ,__, | |
(oo)\\| |___ (oo)\| |___
(__)\\| | )\\_ (__)\| | )\_
| |_w | \\ | |_w | \
| | || * | | || *
Cower.... Cower....
EOC

View File

@ -1,24 +1,22 @@
## ##
## 4.4 >> 5.4 ## 4.4 >> 5.4
## ##
$the_cow = <<EOC;
$thoughts , , $thoughts , ,
$thoughts /( )` $thoughts /( )`
$thoughts \\ \\___ / | $thoughts \ \___ / |
/- _ `-/ ' /- _ `-/ '
(/\\/ \\ \\ /\\ (/\/ \ \ /\
/ / | ` \\ / / | ` \
O O ) / | O O ) / |
`-^--'`< ' `-^--'`< '
(_.) _ ) / (_.) _ ) /
`.___/` / `.___/` /
`-----' / `-----' /
<----. __ / __ \\ <----. __ / __ \
<----|====O)))==) \\) /==== <----|====O)))==) \) /====
<----' `--' `.__,' \\ <----' `--' `.__,' \
| | | |
\\ / \ /
______( (_ / \\______ ______( (_ / \______
,' ,-----' | \\ ,' ,-----' | \
`--{__________) \\/ `--{__________) \/
EOC

View File

@ -1,7 +1,8 @@
$the_cow = <<"EOC"; ##
## The default cow
##
$thoughts ^__^ $thoughts ^__^
$thoughts ($eyes)\\_______ $thoughts ($eyes)\_______
(__)\\ )\\/\\ (__)\ )\/\
$tongue ||----w | $tongue ||----w |
|| || || ||
EOC

View File

@ -1,21 +1,20 @@
## ##
## A dragon smiting a cow, possible credit to kube@csua.berkeley.edu ## A dragon smiting a cow, possible credit to kube@csua.berkeley.edu
## ##
$the_cow = <<EOC; ## OFFSET 16
$thoughts ^ /^ $thoughts ^ /^
$thoughts / \\ // \\ $thoughts / \ // \
$thoughts |\\___/| / \\// .\\ $thoughts |\___/| / \// .\
$thoughts /O O \\__ / // | \\ \\ *----* $thoughts /O O \__ / // | \ \ *----*
/ / \\/_/ // | \\ \\ \\ | / / \/_/ // | \ \ \ |
\@___\@` \\/_ // | \\ \\ \\/\\ \\ @___@` \/_ // | \ \ \/\ \
0/0/| \\/_ // | \\ \\ \\ \\ 0/0/| \/_ // | \ \ \ \
0/0/0/0/| \\/// | \\ \\ | | 0/0/0/0/| \/// | \ \ | |
0/0/0/0/0/_|_ / ( // | \\ _\\ | / 0/0/0/0/0/_|_ / ( // | \ _\ | /
0/0/0/0/0/0/`/,_ _ _/ ) ; -. | _ _\\.-~ / / 0/0/0/0/0/0/`/,_ _ _/ ) ; -. | _ _\.-~ / /
,-} _ *-.|.-~-. .~ ~ ,-} _ *-.|.-~-. .~ ~
\\ \\__/ `/\\ / ~-. _ .-~ / \ \__/ `/\ / ~-. _ .-~ /
\\____($eyes) *. } { / \____($eyes) *. } { /
( (--) .----~-.\\ \\-` .~ ( (--) .----~-.\ \-` .~
//__\\\\ \\__ Ack! ///.----..< \\ _ -~ //__\\ \__ Ack! ///.----..< \ _ -~
// \\\\ ///-._ _ _ _ _ _ _{^ - - - - ~ // \\ ///-._ _ _ _ _ _ _{^ - - - - ~
EOC

View File

@ -1,21 +1,19 @@
## ##
## The Whitespace Dragon ## The Whitespace Dragon
## ##
$the_cow = <<EOC; $thoughts / \ //\
$thoughts / \\ //\\ $thoughts |\___/| / \// \\
$thoughts |\\___/| / \\// \\\\ /0 0 \__ / // | \ \
/0 0 \\__ / // | \\ \\ / / \/_/ // | \ \
/ / \\/_/ // | \\ \\ @_^_@'/ \/_ // | \ \
\@_^_\@'/ \\/_ // | \\ \\ //_^_/ \/_ // | \ \
//_^_/ \\/_ // | \\ \\ ( //) | \/// | \ \
( //) | \\/// | \\ \\ ( / /) _|_ / ) // | \ _\
( / /) _|_ / ) // | \\ _\\ ( // /) '/,_ _ _/ ( ; -. | _ _\.-~ .-~~~^-.
( // /) '/,_ _ _/ ( ; -. | _ _\\.-~ .-~~~^-.
(( / / )) ,-{ _ `-.|.-~-. .~ `. (( / / )) ,-{ _ `-.|.-~-. .~ `.
(( // / )) '/\\ / ~-. _ .-~ .-~^-. \\ (( // / )) '/\ / ~-. _ .-~ .-~^-. \
(( /// )) `. { } / \\ \\ (( /// )) `. { } / \ \
(( / )) .----~-.\\ \\-' .~ \\ `. \\^-. (( / )) .----~-.\ \-' .~ \ `. \^-.
///.----..> \\ _ -~ `. ^-` ^-_ ///.----..> \ _ -~ `. ^-` ^-_
///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~ ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
/.-~ /.-~
EOC

View File

@ -1,7 +1,6 @@
## ##
## Do we need to explain this? ## Do we need to explain this?
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts .... $thoughts ....
........ . ........ .
@ -10,5 +9,4 @@ $the_cow = <<EOC;
......... ....... ......... .......
.............................. ..............................
Elephant inside ASCII snake Elephant inside ASCII snake
EOC

View File

@ -1,15 +1,13 @@
## ##
## An elephant out and about ## An elephant out and about
## ##
$the_cow = <<EOC; $thoughts /\ ___ /\
$thoughts /\\ ___ /\\ $thoughts // \/ \/ \\
$thoughts // \\/ \\/ \\\\
(( O O )) (( O O ))
\\\\ / \\ // \\ / \ //
\\/ | | \\/ \/ | | \/
| | | | | | | |
| | | | | | | |
| o | | o |
| | | | | | | |
|m| |m| |m| |m|
EOC

View File

@ -1,16 +1,14 @@
## ##
## Evil-looking eyes ## Evil-looking eyes
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
.::!!!!!!!:. .::!!!!!!!:.
.!!!!!:. .:!!!!!!!!!!!! .!!!!!:. .:!!!!!!!!!!!!
~~~~!!!!!!. .:!!!!!!!!!UWWW\$\$\$ ~~~~!!!!!!. .:!!!!!!!!!UWWW$$$
:\$\$NWX!!: .:!!!!!!XUWW\$\$\$\$\$\$\$\$\$P :$$NWX!!: .:!!!!!!XUWW$$$$$$$$$P
\$\$\$\$\$##WX!: .<!!!!UW\$\$\$\$" \$\$\$\$\$\$\$\$# $$$$$##WX!: .<!!!!UW$$$$" $$$$$$$$#
\$\$\$\$\$ \$\$\$UX :!!UW\$\$\$\$\$\$\$\$\$ 4\$\$\$\$\$* $$$$$ $$$UX :!!UW$$$$$$$$$ 4$$$$$*
^\$\$\$B \$\$\$\$\\ \$\$\$\$\$\$\$\$\$\$\$\$ d\$\$R" ^$$$B $$$$\ $$$$$$$$$$$$ d$$R"
"*\$bd\$\$\$\$ '*\$\$\$\$\$\$\$\$\$\$\$o+#" "*$bd$$$$ '*$$$$$$$$$$$o+#"
"""" """"""" """" """""""
EOC

View File

@ -1,15 +1,13 @@
## ##
## The flaming sheep, contributed by Geordan Rosario (geordan@csua.berkeley.edu) ## The flaming sheep, contributed by Geordan Rosario (geordan@csua.berkeley.edu)
## ##
$the_cow = <<EOC;
$thoughts . . . $thoughts . . .
$thoughts . . . ` , $thoughts . . . ` ,
$thoughts .; . : .' : : : . $thoughts .; . : .' : : : .
$thoughts i..`: i` i.i.,i i . $thoughts i..`: i` i.i.,i i .
$thoughts `,--.|i |i|ii|ii|i: $thoughts `,--.|i |i|ii|ii|i:
U${eyes}U\\.'\@\@\@\@\@\@`.||' U$eyesU\.'@@@@@@`.||'
\\__/(\@\@\@\@\@\@\@\@\@\@)' \__/(@@@@@@@@@@)'
(\@\@\@\@\@\@\@\@) (@@@@@@@@)
`YY~~~~YY' `YY~~~~YY'
|| || || ||
EOC

View File

@ -1,26 +1,24 @@
## ##
## Ghostbusters! ## Ghostbusters!
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
$thoughts __---__ $thoughts __---__
_- /--______ _- /--______
__--( / \\ )XXXXXXXXXXX\\v. __--( / \ )XXXXXXXXXXX\v.
.-XXX( O O )XXXXXXXXXXXXXXX- .-XXX( O O )XXXXXXXXXXXXXXX-
/XXX( U ) XXXXXXX\\ /XXX( U ) XXXXXXX\
/XXXXX( )--_ XXXXXXXXXXX\\ /XXXXX( )--_ XXXXXXXXXXX\
/XXXXX/ ( O ) XXXXXX \\XXXXX\\ /XXXXX/ ( O ) XXXXXX \XXXXX\
XXXXX/ / XXXXXX \\__ \\XXXXX XXXXX/ / XXXXXX \__ \XXXXX
XXXXXX__/ XXXXXX \\__----> XXXXXX__/ XXXXXX \__---->
---___ XXX__/ XXXXXX \\__ / ---___ XXX__/ XXXXXX \__ /
\\- --__/ ___/\\ XXXXXX / ___--/= \- --__/ ___/\ XXXXXX / ___--/=
\\-\\ ___/ XXXXXX '--- XXXXXX \-\ ___/ XXXXXX '--- XXXXXX
\\-\\/XXX\\ XXXXXX /XXXXX \-\/XXX\ XXXXXX /XXXXX
\\XXXXXXXXX \\ /XXXXX/ \XXXXXXXXX \ /XXXXX/
\\XXXXXX > _/XXXXX/ \XXXXXX > _/XXXXX/
\\XXXXX--__/ __-- XXXX/ \XXXXX--__/ __-- XXXX/
-XXXXXXXX--------------- XXXXXX- -XXXXXXXX--------------- XXXXXX-
\\XXXXXXXXXXXXXXXXXXXXXXXXXX/ \XXXXXXXXXXXXXXXXXXXXXXXXXX/
""VXXXXXXXXXXXXXXXXXXV"" ""VXXXXXXXXXXXXXXXXXXV""
EOC

View File

@ -1,11 +1,9 @@
## ##
## Hello Kitty ## Hello Kitty
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
/\\_)o< /\_)o<
| \\ | \
| O . O| | O . O|
\\_____/ \_____/
EOC

View File

@ -1,26 +1,24 @@
## ##
## A lovers' empbrace ## A lovers' embrace
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
,;;;;;;;, ,;;;;;;;,
;;;;;;;;;;;, ;;;;;;;;;;;,
;;;;;'_____;' ;;;;;'_____;'
;;;(/))))|((\\ ;;;(/))))|((\
_;;((((((|)))) _;;((((((|))))
/ |_\\\\\\\\\\\\\\\\\\\\\\\\ / |_\\\\\\\\\\\\
.--~( \\ ~)))))))))))) .--~( \ ~))))))))))))
/ \\ `\\-(((((((((((\\\\ / \ `\-(((((((((((\\
| | `\\ ) |\\ /|) | | `\ ) |\ /|)
| | `. _/ \\_____/ | | | `. _/ \_____/ |
| , `\\~ / | , `\~ /
| \\ \\ / | \ \ /
| `. `\\| / | `. `\| /
| ~- `\\ / | ~- `\ /
\\____~._/~ -_, (\\ \____~._/~ -_, (\
|-----|\\ \\ ';; |-----|\ \ ';;
| | :;;;' \\ | | :;;;' \
| / | | | / | |
| | | | | |
EOC

View File

@ -1,12 +1,10 @@
## ##
## A kitten of sorts, I think ## A kitten of sorts, I think
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
("`-' '-/") .___..--' ' "`-._ ("`-' '-/") .___..--' ' "`-._
` *_ * ) `-. ( ) .`-.__. `) ` *_ * ) `-. ( ) .`-.__. `)
(_Y_.) ' ._ ) `._` ; `` -. .-' (_Y_.) ' ._ ) `._` ; `` -. .-'
_.. `--'_..-_/ /--' _ .' ,4 _.. `--'_..-_/ /--' _ .' ,4
( i l ),-'' ( l i),' ( ( ! .-' ( i l ),-'' ( l i),' ( ( ! .-'
EOC

View File

@ -1,12 +1,10 @@
## ##
## From the canonical koala collection ## From the canonical koala collection
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
___ ___
{~._.~} {~._.~}
( Y ) ( Y )
()~*~() ()~*~()
(_)-(_) (_)-(_)
EOC

View File

@ -1,19 +1,17 @@
## ##
## It's a Kosh Cow! ## It's a Kosh Cow!
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
$thoughts $thoughts
___ _____ ___ ___ _____ ___
/ \\ / /| / \\ / \ / /| / \
| | / / | | | | | / / | | |
| | /____/ | | | | | /____/ | | |
| | | | | | | | | | | | | |
| | | {} | / | | | | | {} | / | |
| | |____|/ | | | | |____|/ | |
| | |==| | | | | |==| | |
| \\___________/ | | \___________/ |
| | | |
| | | |
EOC

View File

@ -1,7 +1,6 @@
## ##
## From the canonical koala collection ## From the canonical koala collection
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts . $thoughts .
___ // ___ //
@ -11,5 +10,4 @@ $the_cow = <<EOC;
(_)-(_) (_)-(_)
Luke Luke
Sywalker Sywalker
koala koala
EOC

View File

@ -1,15 +1,13 @@
## ##
## A meowing tiger? ## A meowing tiger?
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts , _ ___.--'''`--''//-,-_--_. $thoughts , _ ___.--'''`--''//-,-_--_.
\\`"' ` || \\\\ \\ \\\\/ / // / ,-\\\\`,_ \`"' ` || \\ \ \\/ / // / ,-\\`,_
/'` \\ \\ || Y | \\|/ / // / - |__ `-, /'` \ \ || Y | \|/ / // / - |__ `-,
/\@"\\ ` \\ `\\ | | ||/ // | \\/ \\ `-._`-,_., /@"\ ` \ `\ | | ||/ // | \/ \ `-._`-,_.,
/ _.-. `.-\\,___/\\ _/|_/_\\_\\/|_/ | `-._._) / _.-. `.-\,___/\ _/|_/_\_\/|_/ | `-._._)
`-'``/ / | // \\__/\\__ / \\__/ \\ `-'``/ / | // \__/\__ / \__/ \
`-' /-\\/ | -| \\__ \\ |-' | `-' /-\/ | -| \__ \ |-' |
__/\\ / _/ \\/ __,-' ) ,' _|' __/\ / _/ \/ __,-' ) ,' _|'
(((__/(((_.' ((___..-'((__,' (((__/(((_.' ((___..-'((__,'
EOC

View File

@ -1,21 +1,19 @@
## ##
## Milk from Milk and Cheese ## Milk from Milk and Cheese
## ##
$the_cow = <<EOC;
$thoughts ____________ $thoughts ____________
$thoughts |__________| $thoughts |__________|
/ /\\ / /\
/ / \\ / / \
/___________/___/| /___________/___/|
| | | | | |
| ==\\ /== | | | ==\ /== | |
| O O | \\ \\ | | O O | \ \ |
| < | \\ \\| | < | \ \|
/| | \\ \\ /| | \ \
/ | \\_____/ | / / / | \_____/ | / /
/ /| | / /| / /| | / /|
/||\\| | /||\\/ /||\| | /||\/
-------------| -------------|
| | | | | | | |
<__/ \\__> <__/ \__>
EOC

View File

@ -1,14 +1,12 @@
## ##
## MOOfasa. ## MOOfasa.
## ##
$the_cow = <<EOC;
$thoughts ____ $thoughts ____
$thoughts / \\ $thoughts / \
| ^__^ | | ^__^ |
| ($eyes) |______ | ($eyes) |______
| (__) | )\\/\\ | (__) | )\/\
\\____/|----w | \____/|----w |
|| || || ||
Moofasa Moofasa
EOC

View File

@ -1,9 +1,10 @@
$the_cow = <<EOC; ##
## A moose.
##
$thoughts $thoughts
$thoughts \\_\\_ _/_/ $thoughts \_\_ _/_/
$thoughts \\__/ $thoughts \__/
($eyes)\\_______ ($eyes)\_______
(__)\\ )\\/\\ (__)\ )\/\
$tongue ||----w | $tongue ||----w |
|| || || ||
EOC

View File

@ -1,10 +1,8 @@
## ##
## A mutilated cow, from aspolito@csua.berkeley.edu ## A mutilated cow, from aspolito@csua.berkeley.edu
## ##
$the_cow = <<EOC; $thoughts \_______
$thoughts \\_______ v__v $thoughts \ O )
v__v $thoughts \\ O )
($eyes) ||----w | ($eyes) ||----w |
(__) || || \\/\\ (__) || || \/\
$tongue $tongue
EOC

View File

@ -1,22 +1,20 @@
## ##
## Ren ## Ren
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
____ ____
/# /_\\_ /# /_\_
| |/o\\o\\ | |/o\o\
| \\\\_/_/ | \\_/_/
/ |_ | / |_ |
| ||\\_ ~| | ||\_ ~|
| ||| \\/ | ||| \/
| |||_ | |||_
\\// | \// |
|| | || |
||_ \\ ||_ \
\\_| o| \_| o|
/\\___/ /\___/
/ ||||__ / ||||__
(___)_) (___)_)
EOC

View File

@ -1,12 +1,10 @@
## ##
## Satanic cow, source unknown. ## Satanic cow, source unknown.
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts (__) $thoughts (__)
(\\/) (\/)
/-------\\/ /-------\/
/ | 666 || / | 666 ||
* ||----|| * ||----||
~~ ~~ ~~ ~~
EOC

View File

@ -1,13 +1,11 @@
## ##
## The non-flaming sheep. ## The non-flaming sheep.
## ##
$the_cow = <<EOC
$thoughts $thoughts
$thoughts $thoughts
__ __
U${eyes}U\\.'\@\@\@\@\@\@`. U$eyesU\.'@@@@@@`.
\\__/(\@\@\@\@\@\@\@\@\@\@) \__/(@@@@@@@@@@)
(\@\@\@\@\@\@\@\@) (@@@@@@@@)
`YY~~~~YY' `YY~~~~YY'
|| || || ||
EOC

View File

@ -2,14 +2,12 @@
## This 'Scowleton' brought to you by one of ## This 'Scowleton' brought to you by one of
## {appel,kube,rowe}@csua.berkeley.edu ## {appel,kube,rowe}@csua.berkeley.edu
## ##
$the_cow = <<EOC;
$thoughts (__) $thoughts (__)
$thoughts /$eyes| $thoughts /$eyes|
$thoughts (_"_)*+++++++++* $thoughts (_"_)*+++++++++*
//I#\\\\\\\\\\\\\\\\I\\ //I#\\\\\\\\I\
I[I|I|||||I I ` I[I|I|||||I I `
I`I'///'' I I I`I'///'' I I
I I I I I I I I
~ ~ ~ ~ ~ ~ ~ ~
Scowleton Scowleton
EOC

View File

@ -1,10 +1,7 @@
## ##
## A small cow, artist unknown ## A small cow, artist unknown
## ##
$eyes = ".." unless ($eyes);
$the_cow = <<EOC;
$thoughts ,__, $thoughts ,__,
$thoughts ($eyes)____ $thoughts ($eyes)____
(__) )\\ (__) )\
$tongue||--|| * $tongue||--|| *
EOC

View File

@ -1,19 +1,17 @@
## ##
## A stegosaur with a top hat? ## A stegosaur with a top hat?
## ##
$the_cow = <<EOC;
$thoughts . . $thoughts . .
$thoughts / `. .' " $thoughts / `. .' "
$thoughts .---. < > < > .---. $thoughts .---. < > < > .---.
$thoughts | \\ \\ - ~ ~ - / / | $thoughts | \ \ - ~ ~ - / / |
_____ ..-~ ~-..-~ _____ ..-~ ~-..-~
| | \\~~~\\.' `./~~~/ | | \~~~\.' `./~~~/
--------- \\__/ \\__/ --------- \__/ \__/
.' O \\ / / \\ " .' O \ / / \ "
(_____, `._.' | } \\/~~~/ (_____, `._.' | } \/~~~/
`----. / } | / \\__/ `----. / } | / \__/
`-. | / | / `. ,~~| `-. | / | / `. ,~~|
~-.__| /_ - ~ ^| /- _ `..-' ~-.__| /_ - ~ ^| /- _ `..-'
| / | / ~-. `-. _ _ _ | / | / ~-. `-. _ _ _
|_____| |_____| ~ - . _ _ _ _ _> |_____| |_____| ~ - . _ _ _ _ _>
EOC

View File

@ -1,19 +1,17 @@
## ##
## Stimpy! ## Stimpy!
## ##
$the_cow = <<EOC;
$thoughts . _ . $thoughts . _ .
$thoughts |\\_|/__/| $thoughts |\_|/__/|
/ / \\/ \\ \\ / / \/ \ \
/__|O||O|__ \\ /__|O||O|__ \
|/_ \\_/\\_/ _\\ | |/_ \_/\_/ _\ |
| | (____) | || | | (____) | ||
\\/\\___/\\__/ // \/\___/\__/ //
(_/ || (_/ ||
| || | ||
| ||\\ | ||\
\\ //_/ \ //_/
\\______// \______//
__ || __|| __ || __||
(____(____) (____(____)
EOC

View File

@ -1,10 +1,8 @@
## ##
## A cow being milked, probably from Lars Smith (lars@csua.berkeley.edu) ## A cow being milked, probably from Lars Smith (lars@csua.berkeley.edu)
## ##
$the_cow = <<EOC;
$thoughts ^__^ $thoughts ^__^
$thoughts ($eyes)\\_______ ________ $thoughts ($eyes)\_______ ________
(__)\\ )\\/\\ |Super | (__)\ )\/\ |Super |
$tongue ||----W | |Milker| $tongue ||----W | |Milker|
|| UDDDDDDDDD|______| || UDDDDDDDDD|______|
EOC

View File

@ -1,24 +1,22 @@
## ##
## A cow operation, artist unknown ## A cow operation, artist unknown
## ##
$the_cow = <<EOC; $thoughts \ /
$thoughts \\ / $thoughts \/
$thoughts \\/ (__) /\
(__) /\\
($eyes) O O ($eyes) O O
_\\/_ // _\/_ //
* ( ) // * ( ) //
\\ (\\\\ // \ (\\ //
\\( \\\\ ) \( \\ )
( \\\\ ) /\\ ( \\ ) /\
___[\\______/^^^^^^^\\__/) o-)__ ___[\______/^^^^^^^\__/) o-)__
|\\__[=======______//________)__\\ |\__[=======______//________)__\
\\|_______________//____________| \|_______________//____________|
||| || //|| ||| ||| || //|| |||
||| || @.|| ||| ||| || @.|| |||
|| \\/ .\\/ || || \/ .\/ ||
. . . .
'.'.` '.'.`
COW-OPERATION COW-OPERATION
EOC

View File

@ -1,12 +1,8 @@
## ##
## A cow with three eyes, brought to you by dpetrou@csua.berkeley.edu ## A cow with three eyes, brought to you by dpetrou@csua.berkeley.edu
## ##
$extra = chop($eyes);
$eyes .= ($extra x 2);
$the_cow = <<EOC;
$thoughts ^___^ $thoughts ^___^
$thoughts ($eyes)\\_______ $thoughts ($el$el$el)\_______
(___)\\ )\\/\\ (___)\ )\/\
$tongue ||----w | $tongue ||----w |
|| || || ||
EOC

View File

@ -1,26 +1,24 @@
## ##
## Turkey! ## Turkey!
## ##
$the_cow = <<EOC;
$thoughts ,+*^^*+___+++_ $thoughts ,+*^^*+___+++_
$thoughts ,*^^^^ ) $thoughts ,*^^^^ )
$thoughts _+* ^**+_ $thoughts _+* ^**+_
$thoughts +^ _ _++*+_+++_, ) $thoughts +^ _ _++*+_+++_, )
_+^^*+_ ( ,+*^ ^ \\+_ ) _+^^*+_ ( ,+*^ ^ \+_ )
{ ) ( ,( ,_+--+--, ^) ^\\ { ) ( ,( ,_+--+--, ^) ^\
{ (\@) } f ,( ,+-^ __*_*_ ^^\\_ ^\\ ) { (@) } f ,( ,+-^ __*_*_ ^^\_ ^\ )
{:;-/ (_+*-+^^^^^+*+*<_ _++_)_ ) ) / {:;-/ (_+*-+^^^^^+*+*<_ _++_)_ ) ) /
( / ( ( ,___ ^*+_+* ) < < \\ ( / ( ( ,___ ^*+_+* ) < < \
U _/ ) *--< ) ^\\-----++__) ) ) ) U _/ ) *--< ) ^\-----++__) ) ) )
( ) _(^)^^)) ) )\\^^^^^))^*+/ / / ( ) _(^)^^)) ) )\^^^^^))^*+/ / /
( / (_))_^)) ) ) ))^^^^^))^^^)__/ +^^ ( / (_))_^)) ) ) ))^^^^^))^^^)__/ +^^
( ,/ (^))^)) ) ) ))^^^^^^^))^^) _) ( ,/ (^))^)) ) ) ))^^^^^^^))^^) _)
*+__+* (_))^) ) ) ))^^^^^^))^^^^^)____*^ *+__+* (_))^) ) ) ))^^^^^^))^^^^^)____*^
\\ \\_)^)_)) ))^^^^^^^^^^))^^^^) \ \_)^)_)) ))^^^^^^^^^^))^^^^)
(_ ^\\__^^^^^^^^^^^^))^^^^^^^) (_ ^\__^^^^^^^^^^^^))^^^^^^^)
^\\___ ^\\__^^^^^^))^^^^^^^^)\\\\ ^\___ ^\__^^^^^^))^^^^^^^^)\\
^^^^^\\uuu/^^\\uuu/^^^^\\^\\^\\^\\^\\^\\^\\^\\ ^^^^^\uuu/^^\uuu/^^^^\^\^\^\^\^\^\^\
___) >____) >___ ^\\_\\_\\_\\_\\_\\_\\) ___) >____) >___ ^\_\_\_\_\_\_\)
^^^//\\\\_^^//\\\\_^ ^(\\_\\_\\_\\) ^^^//\\_^^//\\_^ ^(\_\_\_\)
^^^ ^^ ^^^ ^ ^^^ ^^ ^^^ ^
EOC

View File

@ -1,20 +1,18 @@
## ##
## A mysterious turtle... ## A mysterious turtle...
## ##
$the_cow = <<EOC;
$thoughts ___-------___ $thoughts ___-------___
$thoughts _-~~ ~~-_ $thoughts _-~~ ~~-_
$thoughts _-~ /~-_ $thoughts _-~ /~-_
/^\\__/^\\ /~ \\ / \\ /^\__/^\ /~ \ / \
/| O|| O| / \\_______________/ \\ /| O|| O| / \_______________/ \
| |___||__| / / \\ \\ | |___||__| / / \ \
| \\ / / \\ \\ | \ / / \ \
| (_______) /______/ \\_________ \\ | (_______) /______/ \_________ \
| / / \\ / \\ | / / \ / \
\\ \\^\\\\ \\ / \\ / \ \^\\ \ / \ /
\\ || \\______________/ _-_ //\\__// \ || \______________/ _-_ //\__//
\\ ||------_-~~-_ ------------- \\ --/~ ~\\ || __/ \ ||------_-~~-_ ------------- \ --/~ ~\ || __/
~-----||====/~ |==================| |/~~~~~ ~-----||====/~ |==================| |/~~~~~
(_(__/ ./ / \\_\\ \\. (_(__/ ./ / \_\ \.
(_(___/ \\_____)_) (_(___/ \_____)_)
EOC

View File

@ -2,15 +2,12 @@
## TuX ## TuX
## (c) pborys@p-soft.silesia.linux.org.pl ## (c) pborys@p-soft.silesia.linux.org.pl
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts $thoughts
.--. .--.
|o_o | |o_o |
|:_/ | |:_/ |
// \\ \\ // \ \
(| | ) (| | )
/'\\_ _/`\\ /'\_ _/`\
\\___)=(___/ \___)=(___/
EOC

View File

@ -1,16 +1,12 @@
## ##
## The cow from a file called cow-n-horn, artist unknown. ## The cow from a file called cow-n-horn, artist unknown.
## ##
$other_eye = chop($eyes);
$eyes .= " $other_eye";
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts (__) $thoughts (__)
$eyes\\ $el $er\
('') \\--------- ('') \---------
$tongue\\ \\ $tongue\ \
| |\\ | |\
||---( )_|| * ||---( )_|| *
|| UU || || UU ||
== == == ==
EOC

View File

@ -1,7 +1,6 @@
## ##
## Another canonical koala? ## Another canonical koala?
## ##
$the_cow = <<EOC;
$thoughts $thoughts
$thoughts . $thoughts .
.---. // .---. //
@ -12,5 +11,4 @@ $the_cow = <<EOC;
Darth Darth
Vader Vader
koala koala
EOC

View File

@ -1,13 +1,11 @@
## ##
## Cowth Vader, from geordan@csua.berkeley.edu ## Cowth Vader, from geordan@csua.berkeley.edu
## ##
$the_cow = <<EOC;
$thoughts ,-^-. $thoughts ,-^-.
$thoughts !oYo! $thoughts !oYo!
$thoughts /./=\\.\\______ $thoughts /./=\.\______
## )\\/\\ ## )\/\
||-----w|| ||-----w||
|| || || ||
Cowth Vader Cowth Vader
EOC

View File

@ -1,10 +1,8 @@
## ##
## A cow wadvertising the World Wide Web, from lim@csua.berkeley.edu ## A cow advertising the World Wide Web, from lim@csua.berkeley.edu
## ##
$the_cow = <<EOC;
$thoughts ^__^ $thoughts ^__^
$thoughts ($eyes)\\_______ $thoughts ($eyes)\_______
(__)\\ )\\/\\ (__)\ )\/\
$tongue ||--WWW | $tongue ||--WWW |
|| || || ||
EOC

7
go.mod Normal file
View File

@ -0,0 +1,7 @@
module git.yetaga.in/alazyreader/cowsay
go 1.22.1
require golang.org/x/term v0.18.0
require golang.org/x/sys v0.18.0 // indirect

4
go.sum Normal file
View File

@ -0,0 +1,4 @@
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=

313
main.go Normal file
View File

@ -0,0 +1,313 @@
package main
import (
"bytes"
"embed"
"flag"
"fmt"
"io"
"log"
"os"
"strconv"
"strings"
"golang.org/x/term"
)
const DEBUG = false
var (
// upper-left, upper-right, left side, right side, bottom-left, bottom-right
SAY_BORDER = []rune{'/', '\\', '|', '|', '\\', '/'}
SINGLE_BORDER = []rune{'<', '>'}
THINK_BORDER = []rune{'(', ')', '(', ')', '(', ')'}
)
type options struct {
thinking bool
tongue string
eyes string
leftEye string
rightEye string
wrapWidth int
}
// the cowfiles
//
//go:embed cows/*
var cowTemplates embed.FS
func main() {
// basic flags
cowFile := flag.String("cow", "default.cow", "the cowfile to use")
tongue := flag.String("T", " ", "the tongue to print")
eyesFlag := flag.String("e", "oo", "the eyes")
width := flag.Int("W", 40, "approximate column width for the word-wrap")
// also need to check for binary name here
thinkFlag := flag.Bool("think", false, "if the cow is thinking the input instead")
// flags for special conditions
// these flags override -e and -T if set
borgFlag := flag.Bool("b", false, "borg cow") // ==
deadFlag := flag.Bool("d", false, "dead cow") // xx AND tongue "U "
greedyFlag := flag.Bool("g", false, "greedy cow") // $$
paranoidFlag := flag.Bool("p", false, "paranoid cow") // @@
stonedFlag := flag.Bool("s", false, "stoned cow") // ** AND tongue "U "
tiredFlag := flag.Bool("t", false, "tired cow") // --
wiredFlag := flag.Bool("w", false, "wired cow") // OO
youngFlag := flag.Bool("y", false, "young cow") // ..
flag.Parse()
input := flag.Arg(0)
if len(*tongue) < 2 {
*tongue = *tongue + strings.Repeat(" ", 2-len(*tongue))
}
if len(*eyesFlag) < 2 {
*eyesFlag = *eyesFlag + strings.Repeat(" ", 2-len(*eyesFlag))
}
opts := options{
thinking: *thinkFlag,
tongue: (*tongue)[0:2],
eyes: (*eyesFlag)[0:2],
wrapWidth: *width,
}
switch {
case *borgFlag:
opts.eyes = "=="
case *deadFlag:
opts.eyes = "xx"
opts.tongue = "U "
case *greedyFlag:
opts.eyes = "$$"
case *paranoidFlag:
opts.eyes = "@@"
case *stonedFlag:
opts.eyes = "**"
opts.tongue = "U "
case *tiredFlag:
opts.eyes = "--"
case *wiredFlag:
opts.eyes = "OO"
case *youngFlag:
opts.eyes = ".."
}
opts.leftEye = strings.Split(*eyesFlag, "")[0]
opts.rightEye = strings.Split(*eyesFlag, "")[1]
// if there is command-line input, ignore stdin.
if !term.IsTerminal(0) && input != "" {
pipedInput, err := io.ReadAll(os.Stdin)
if err != nil {
log.Fatalf("error reading from stdin: %v", err)
}
input = string(bytes.TrimSpace(pipedInput))
}
if input == "" {
log.Fatal("no input; cow can't say anything")
}
b, err := cowTemplates.ReadFile("cows/" + *cowFile)
if err != nil {
log.Fatal(err)
}
fmt.Print(generateCow(string(b), input, opts))
}
func generateCow(cow, say string, opt options) string {
cowSlice := strings.Split(cow, "\n")
offset := 0
// Remove comments
i := 0
for _, s := range cowSlice {
if strings.HasPrefix(s, "##") && strings.Contains(s, "OFFSET") {
_, off, found := strings.Cut(s, "OFFSET ")
if found {
offset, _ = strconv.Atoi(off)
}
}
if !strings.HasPrefix(s, "##") {
cowSlice[i] = s
i++
}
}
cow = strings.Join(cowSlice[:i], "\n")
// do replaces
tail := `\`
if opt.thinking {
tail = `o`
}
cow = strings.ReplaceAll(cow, "$thoughts", tail)
cow = strings.ReplaceAll(cow, "$eyes", opt.eyes)
cow = strings.ReplaceAll(cow, "$el", opt.leftEye)
cow = strings.ReplaceAll(cow, "$er", opt.rightEye)
cow = strings.ReplaceAll(cow, "$tongue", opt.tongue)
out := &bytes.Buffer{}
fmt.Fprint(out, bubble(say, opt.thinking, opt.wrapWidth, offset))
fmt.Fprintln(out)
fmt.Fprint(out, cow)
fmt.Fprintln(out)
return out.String()
}
// this is an attempt to emulate the rather poorly-documented behavior of Text::Wrap::fill
// from CPAN: https://github.com/ap/Text-Tabs/blob/master/lib.modern/Text/Wrap.pm
// The basic idea is: take an input. Format each "paragraph" of text independently,
// then merge with empty lines between.
//
// What is under-defined in the documentation is what fill() considers a "paragraph".
// From testing and reviewing the rather obtuse code, a paragraph is any number of lines
// that start with a line that has optional whitespace at its start, then all subsequent lines
// that have no whitespace at the start, until either reaching another line that has leading
// whitespace, or a blank line. fill() also "destroy[s] any whitespace in the original text",
// by which it appearently means all tabs and multiple-spaces are replaced with single-spaces.
//
// So, for example, `text\ntext` is one paragraph, `text\n text` is two paragraphs. Since for
// our purposes we don't want any indentation of paragraphs, the output of these two examples
// should be `text text` and `text\n\ntext`, respectively.
//
// This is a pretty gnarly! Might be easier in a multi-pass model: collect together each paragraph,
// collapse them into single strings and format in a sub-function, then merge them all together.
// That's closer to how the perl module does it.
func wordWrap(text []string, column int) ([]string, int) {
out := []string{}
length := 0
var b strings.Builder
var inParagraph bool
for beginning, line := range text {
// remove control character whitespace
line = strings.ReplaceAll(line, "\t", " ")
line = strings.ReplaceAll(line, "\v", " ")
line = strings.ReplaceAll(line, "\f", " ")
line = strings.ReplaceAll(line, "\r", " ")
words := strings.Split(line, " ")
// skip empty newlines if not in a paragraph, but start a new paragraph if we are.
if strings.TrimSpace(line) == "" {
if inParagraph {
length = max(length, b.Len()-1)
out = append(out, b.String()[0:b.Len()-1])
out = append(out, "")
b = strings.Builder{}
inParagraph = false
}
continue
}
// we -1 all over the place to clean up the loose space on the end of the builder
for i, word := range words { // split into words
if DEBUG {
log.Printf("%d, `%s`", i, b.String())
}
if inParagraph && i == 0 && word == "" && len(words) != 0 {
// we've found a new paragraph while we were still processing the old one.
// (that is, the new line we're parsing had leading whitespace)
length = max(length, b.Len()-1)
out = append(out, b.String()[0:b.Len()-1])
out = append(out, "")
b = strings.Builder{}
log.Println("here")
}
// bizarrely, cowsay allows for indentation to survive in the /first/ paragraph,
// but only up to two spaces worth.
if beginning == 0 && (b.Len() == 0 || b.String() == " ") && word == "" {
b.WriteRune(' ')
}
if b.Len() == 0 && word != "" {
inParagraph = true
}
if b.Len() >= 0 && word == "" && i+1 != len(words) {
// skip multiple spaces in a row...
// ...but a single trailing space on a line is OK??
continue
}
if b.Len() > 0 && b.Len()+len(word)+1 > column {
// if the word we want to append is bigger than we have room for,
// save off the maximum length, save the current line to the output,
// and start a new builder.
length = max(length, b.Len()-1)
out = append(out, b.String()[0:b.Len()-1])
b = strings.Builder{}
}
for b.Len() == 0 && len(word) >= column {
// our word is longer than our maximum column size. let's break it up.
// we loop until we've consumed the full overly-long word.
length = max(length, column-1)
out = append(out, word[0:column-1])
word = word[column-1:]
b = strings.Builder{}
}
// actually append the word and a space
b.WriteString(word)
b.WriteRune(' ')
if DEBUG {
log.Printf("%d, `%s`", i, b.String())
}
}
}
// out of words! save off our last line.
length = max(length, b.Len()-1)
out = append(out, b.String()[0:b.Len()-1])
return out, length
}
func padText(text []string, maxLength int) []string {
for i, line := range text {
if len(line) < maxLength {
text[i] = text[i] + strings.Repeat(" ", maxLength-len(line))
}
}
return text
}
func bubble(text string, think bool, column int, offset int) string {
s, column := wordWrap(strings.Split(text, "\n"), column)
s = padText(s, column)
b := strings.Builder{}
padding := strings.Repeat(" ", offset)
b.WriteString(padding)
b.WriteString(" ")
b.WriteString(strings.Repeat("_", column+2))
b.WriteString(" \n")
var borderStyle []rune
if think {
borderStyle = THINK_BORDER
} else if len(s) == 1 {
borderStyle = SINGLE_BORDER
} else {
borderStyle = SAY_BORDER
}
for i := range s {
b.WriteString(padding)
if i == 0 {
b.WriteRune(borderStyle[0])
} else if i == len(s)-1 {
b.WriteRune(borderStyle[4])
} else {
b.WriteRune(borderStyle[2])
}
b.WriteRune(' ')
b.WriteString(s[i])
b.WriteRune(' ')
if i == 0 {
b.WriteRune(borderStyle[1])
} else if i == len(s)-1 {
b.WriteRune(borderStyle[5])
} else {
b.WriteRune(borderStyle[3])
}
b.WriteRune('\n')
}
b.WriteString(padding)
b.WriteString(" ")
b.WriteString(strings.Repeat("-", column+2))
b.WriteString(" ")
return b.String()
}

172
main_test.go Normal file
View File

@ -0,0 +1,172 @@
package main
import (
"os"
"os/exec"
"strings"
"testing"
)
func must[T any](t T, err error) T {
if err != nil {
panic(err)
}
return t
}
var defaultOptions options = options{
tongue: " ",
eyes: "oo",
leftEye: "o",
rightEye: "o",
wrapWidth: 40,
}
func TestGenerateCow(t *testing.T) {
type args struct {
cow string
say string
opt options
}
tests := []struct {
name string
args args
expected string
}{
{
name: "basic cow",
args: args{
cow: string(must(os.ReadFile("./cows/default.cow"))),
say: "test text",
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/basic.cow"))),
},
{
name: "single-paragraph test",
args: args{
cow: string(must(os.ReadFile("./cows/default.cow"))),
say: "test\ntext",
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/one_paragraph.cow"))),
},
{
name: "multiline with wordwrap test",
args: args{
cow: string(must(os.ReadFile("./cows/default.cow"))),
say: "this is a long block of text.\nIt goes over many lines! It'll even word-wrap for us.",
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/longer_multiline.cow"))),
},
{
name: "two-paragraph multiline with wordwrap test",
args: args{
cow: string(must(os.ReadFile("./cows/default.cow"))),
say: "this is a long block of text.\n\nIt goes over many lines! It'll even word-wrap for us.",
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/two_paragraph_multiline.cow"))),
},
{
name: "offset bubble",
args: args{
cow: string(must(os.ReadFile("./cows/dragon-and-cow.cow"))),
say: "this is a long block of text.\nIt goes over many lines! It'll even word-wrap for us.",
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/dragon.cow"))),
},
{
name: "leading space cow",
args: args{
cow: string(must(os.ReadFile("./cows/default.cow"))),
say: " text",
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/leading_space.cow"))),
},
{
name: "extra spaces cow",
args: args{
cow: string(must(os.ReadFile("./cows/default.cow"))),
say: "some text",
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/extra_spaces.cow"))),
},
{
name: "vertical tab cow",
args: args{
cow: string(must(os.ReadFile("./cows/default.cow"))),
say: "some\vtext",
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/extra_spaces.cow"))),
},
{
name: "a word that's too long cow",
args: args{
cow: string(must(os.ReadFile("./cows/default.cow"))),
say: "00000000000000000000000000000000000000000000000000 11",
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/too_long.cow"))),
},
{
name: "fortune cow",
args: args{
cow: string(must(os.ReadFile("./cows/default.cow"))),
say: `Most people eat as though they were fattening themselves for market.
-- E.W. Howe`,
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/fortune.cow"))),
},
{
name: "trailing space cow",
args: args{
cow: string(must(os.ReadFile("./cows/default.cow"))),
say: `test `,
opt: defaultOptions,
},
expected: string(must(os.ReadFile("./testdata/trailing_space.cow"))),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
out := generateCow(tt.args.cow, tt.args.say, tt.args.opt)
if out != tt.expected {
t.Logf("expected: \n%v", tt.expected)
t.Logf("got: \n%v", out)
t.Fatal()
}
})
}
}
// fuzz testing requires perl to be installed and in the PATH
func FuzzCow(f *testing.F) {
cowString := string(must(os.ReadFile("./cows/default.cow")))
f.Add("phrase")
f.Add("phrase with many many words in it so that we get a word-wrap situation")
f.Fuzz(func(t *testing.T, phrase string) {
if strings.TrimSpace(phrase) != phrase || phrase == "" {
// uninteresting degenerate cases where there's a bug in the perl
t.Skip()
}
res := generateCow(cowString, phrase, options{tongue: " ", eyes: "oo", wrapWidth: 40})
cmd := exec.Command("perl", "./perl/cowsay", "-f", "./perl/cows/default.cow")
cmd.Stdin = strings.NewReader(phrase)
var out strings.Builder
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
t.Error(err)
}
if res != out.String() {
t.Errorf("mismatch between perl and go.\nPerl:\n%s\ngo:\n%s", out.String(), res)
}
})
}

View File

View File

23
perl/cows/beavis.zen.cow Normal file
View File

@ -0,0 +1,23 @@
##
## Beavis, with Zen philosophy removed.
##
$the_cow = <<EOC;
$thoughts __------~~-,
$thoughts ,' ,
/ \\
/ :
| '
| |
| |
| _-- |
_| =-. .-. ||
o|/o/ _. |
/ ~ \\ |
(____\@) ___~ |
|_===~~~.` |
_______.--~ |
\\________ |
\\ |
__/-___-- -__
/ _ \\
EOC

29
perl/cows/blowfish.cow Normal file
View File

@ -0,0 +1,29 @@
##
## Blowfish
##
$the_cow = <<EOC;
$thoughts
$thoughts
| .
. |L /|
_ . |\\ _| \\--+._/| .
/ ||\\| Y J ) / |/| ./
J |)'( | ` F`.'/
-<| F __ .-<
| / .-'. `. /-. L___
J \\ < \\ | | O\\|.-'
_J \\ .- \\/ O | | \\ |F
'-F -<_. \\ .-' `-' L__
__J _ _. >-' )._. |-'
`-|.' /_. \\_| F
/.- . _.<
/' /.' .' `\\
/L /' |/ _.-'-\\
/'J ___.---'\\|
|\\ .--' V | `. `
|/`. `-. `._)
/ .-.\\
VK \\ ( `\\
`.\\
EOC

16
perl/cows/bong.cow Normal file
View File

@ -0,0 +1,16 @@
##
## A cow with a bong, from lars@csua.berkeley.edu
##
$the_cow = <<EOC;
$thoughts
$thoughts
^__^
_______/($eyes)
/\\/( /(__)
| W----|| |~|
|| || |~| ~~
|~| ~
|_| o
|#|/
_+#+_
EOC

12
perl/cows/bud-frogs.cow Normal file
View File

@ -0,0 +1,12 @@
##
## The Budweiser frogs
##
$the_cow = <<EOC;
$thoughts
$thoughts
oO)-. .-(Oo
/__ _\\ /_ __\\
\\ \\( | ()~() | )/ /
\\__|\\ | (-___-) | /|__/
' '--' ==`-'== '--' '
EOC

10
perl/cows/bunny.cow Normal file
View File

@ -0,0 +1,10 @@
##
## A cute little wabbit
##
$the_cow = <<EOC;
$thoughts
$thoughts \\
\\ /\\
( )
.( o ).
EOC

23
perl/cows/cheese.cow Normal file
View File

@ -0,0 +1,23 @@
##
## The cheese from milk & cheese
##
$the_cow = <<EOC;
$thoughts
$thoughts
_____ _________
/ \\_/ |
| ||
| ||
| ###\\ /### | |
| 0 \\/ 0 | |
/| | |
/ | < |\\ \\
| /| | | |
| | \\_______/ | | |
| | | / /
/|| /|||
----------------|
| | | |
*** ***
/___\\ /___\\
EOC

14
perl/cows/cower.cow Normal file
View File

@ -0,0 +1,14 @@
##
## A cowering cow
##
$the_cow = <<EOC;
$thoughts
$thoughts
,__, | |
(oo)\\| |___
(__)\\| | )\\_
| |_w | \\
| | || *
Cower....
EOC

24
perl/cows/daemon.cow Normal file
View File

@ -0,0 +1,24 @@
##
## 4.4 >> 5.4
##
$the_cow = <<EOC;
$thoughts , ,
$thoughts /( )`
$thoughts \\ \\___ / |
/- _ `-/ '
(/\\/ \\ \\ /\\
/ / | ` \\
O O ) / |
`-^--'`< '
(_.) _ ) /
`.___/` /
`-----' /
<----. __ / __ \\
<----|====O)))==) \\) /====
<----' `--' `.__,' \\
| |
\\ /
______( (_ / \\______
,' ,-----' | \\
`--{__________) \\/
EOC

7
perl/cows/default.cow Normal file
View File

@ -0,0 +1,7 @@
$the_cow = <<"EOC";
$thoughts ^__^
$thoughts ($eyes)\\_______
(__)\\ )\\/\\
$tongue ||----w |
|| ||
EOC

View File

@ -0,0 +1,21 @@
##
## A dragon smiting a cow, possible credit to kube@csua.berkeley.edu
##
$the_cow = <<EOC;
$thoughts ^ /^
$thoughts / \\ // \\
$thoughts |\\___/| / \\// .\\
$thoughts /O O \\__ / // | \\ \\ *----*
/ / \\/_/ // | \\ \\ \\ |
\@___\@` \\/_ // | \\ \\ \\/\\ \\
0/0/| \\/_ // | \\ \\ \\ \\
0/0/0/0/| \\/// | \\ \\ | |
0/0/0/0/0/_|_ / ( // | \\ _\\ | /
0/0/0/0/0/0/`/,_ _ _/ ) ; -. | _ _\\.-~ / /
,-} _ *-.|.-~-. .~ ~
\\ \\__/ `/\\ / ~-. _ .-~ /
\\____($eyes) *. } { /
( (--) .----~-.\\ \\-` .~
//__\\\\ \\__ Ack! ///.----..< \\ _ -~
// \\\\ ///-._ _ _ _ _ _ _{^ - - - - ~
EOC

21
perl/cows/dragon.cow Normal file
View File

@ -0,0 +1,21 @@
##
## The Whitespace Dragon
##
$the_cow = <<EOC;
$thoughts / \\ //\\
$thoughts |\\___/| / \\// \\\\
/0 0 \\__ / // | \\ \\
/ / \\/_/ // | \\ \\
\@_^_\@'/ \\/_ // | \\ \\
//_^_/ \\/_ // | \\ \\
( //) | \\/// | \\ \\
( / /) _|_ / ) // | \\ _\\
( // /) '/,_ _ _/ ( ; -. | _ _\\.-~ .-~~~^-.
(( / / )) ,-{ _ `-.|.-~-. .~ `.
(( // / )) '/\\ / ~-. _ .-~ .-~^-. \\
(( /// )) `. { } / \\ \\
(( / )) .----~-.\\ \\-' .~ \\ `. \\^-.
///.----..> \\ _ -~ `. ^-` ^-_
///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
/.-~
EOC

View File

@ -0,0 +1,14 @@
##
## Do we need to explain this?
##
$the_cow = <<EOC;
$thoughts
$thoughts ....
........ .
. .
. .
......... .......
..............................
Elephant inside ASCII snake
EOC

15
perl/cows/elephant.cow Normal file
View File

@ -0,0 +1,15 @@
##
## An elephant out and about
##
$the_cow = <<EOC;
$thoughts /\\ ___ /\\
$thoughts // \\/ \\/ \\\\
(( O O ))
\\\\ / \\ //
\\/ | | \\/
| | | |
| | | |
| o |
| | | |
|m| |m|
EOC

16
perl/cows/eyes.cow Normal file
View File

@ -0,0 +1,16 @@
##
## Evil-looking eyes
##
$the_cow = <<EOC;
$thoughts
$thoughts
.::!!!!!!!:.
.!!!!!:. .:!!!!!!!!!!!!
~~~~!!!!!!. .:!!!!!!!!!UWWW\$\$\$
:\$\$NWX!!: .:!!!!!!XUWW\$\$\$\$\$\$\$\$\$P
\$\$\$\$\$##WX!: .<!!!!UW\$\$\$\$" \$\$\$\$\$\$\$\$#
\$\$\$\$\$ \$\$\$UX :!!UW\$\$\$\$\$\$\$\$\$ 4\$\$\$\$\$*
^\$\$\$B \$\$\$\$\\ \$\$\$\$\$\$\$\$\$\$\$\$ d\$\$R"
"*\$bd\$\$\$\$ '*\$\$\$\$\$\$\$\$\$\$\$o+#"
"""" """""""
EOC

View File

@ -0,0 +1,15 @@
##
## The flaming sheep, contributed by Geordan Rosario (geordan@csua.berkeley.edu)
##
$the_cow = <<EOC;
$thoughts . . .
$thoughts . . . ` ,
$thoughts .; . : .' : : : .
$thoughts i..`: i` i.i.,i i .
$thoughts `,--.|i |i|ii|ii|i:
U${eyes}U\\.'\@\@\@\@\@\@`.||'
\\__/(\@\@\@\@\@\@\@\@\@\@)'
(\@\@\@\@\@\@\@\@)
`YY~~~~YY'
|| ||
EOC

View File

@ -0,0 +1,26 @@
##
## Ghostbusters!
##
$the_cow = <<EOC;
$thoughts
$thoughts
$thoughts __---__
_- /--______
__--( / \\ )XXXXXXXXXXX\\v.
.-XXX( O O )XXXXXXXXXXXXXXX-
/XXX( U ) XXXXXXX\\
/XXXXX( )--_ XXXXXXXXXXX\\
/XXXXX/ ( O ) XXXXXX \\XXXXX\\
XXXXX/ / XXXXXX \\__ \\XXXXX
XXXXXX__/ XXXXXX \\__---->
---___ XXX__/ XXXXXX \\__ /
\\- --__/ ___/\\ XXXXXX / ___--/=
\\-\\ ___/ XXXXXX '--- XXXXXX
\\-\\/XXX\\ XXXXXX /XXXXX
\\XXXXXXXXX \\ /XXXXX/
\\XXXXXX > _/XXXXX/
\\XXXXX--__/ __-- XXXX/
-XXXXXXXX--------------- XXXXXX-
\\XXXXXXXXXXXXXXXXXXXXXXXXXX/
""VXXXXXXXXXXXXXXXXXXV""
EOC

11
perl/cows/hellokitty.cow Normal file
View File

@ -0,0 +1,11 @@
##
## Hello Kitty
##
$the_cow = <<EOC;
$thoughts
$thoughts
/\\_)o<
| \\
| O . O|
\\_____/
EOC

26
perl/cows/kiss.cow Normal file
View File

@ -0,0 +1,26 @@
##
## A lovers' empbrace
##
$the_cow = <<EOC;
$thoughts
$thoughts
,;;;;;;;,
;;;;;;;;;;;,
;;;;;'_____;'
;;;(/))))|((\\
_;;((((((|))))
/ |_\\\\\\\\\\\\\\\\\\\\\\\\
.--~( \\ ~))))))))))))
/ \\ `\\-(((((((((((\\\\
| | `\\ ) |\\ /|)
| | `. _/ \\_____/ |
| , `\\~ /
| \\ \\ /
| `. `\\| /
| ~- `\\ /
\\____~._/~ -_, (\\
|-----|\\ \\ ';;
| | :;;;' \\
| / | |
| | |
EOC

12
perl/cows/kitty.cow Normal file
View File

@ -0,0 +1,12 @@
##
## A kitten of sorts, I think
##
$the_cow = <<EOC;
$thoughts
$thoughts
("`-' '-/") .___..--' ' "`-._
` *_ * ) `-. ( ) .`-.__. `)
(_Y_.) ' ._ ) `._` ; `` -. .-'
_.. `--'_..-_/ /--' _ .' ,4
( i l ),-'' ( l i),' ( ( ! .-'
EOC

12
perl/cows/koala.cow Normal file
View File

@ -0,0 +1,12 @@
##
## From the canonical koala collection
##
$the_cow = <<EOC;
$thoughts
$thoughts
___
{~._.~}
( Y )
()~*~()
(_)-(_)
EOC

19
perl/cows/kosh.cow Normal file
View File

@ -0,0 +1,19 @@
##
## It's a Kosh Cow!
##
$the_cow = <<EOC;
$thoughts
$thoughts
$thoughts
___ _____ ___
/ \\ / /| / \\
| | / / | | |
| | /____/ | | |
| | | | | | |
| | | {} | / | |
| | |____|/ | |
| | |==| | |
| \\___________/ |
| |
| |
EOC

15
perl/cows/luke-koala.cow Normal file
View File

@ -0,0 +1,15 @@
##
## From the canonical koala collection
##
$the_cow = <<EOC;
$thoughts
$thoughts .
___ //
{~._.~}//
( Y )K/
()~*~()
(_)-(_)
Luke
Sywalker
koala
EOC

15
perl/cows/meow.cow Normal file
View File

@ -0,0 +1,15 @@
##
## A meowing tiger?
##
$the_cow = <<EOC;
$thoughts
$thoughts , _ ___.--'''`--''//-,-_--_.
\\`"' ` || \\\\ \\ \\\\/ / // / ,-\\\\`,_
/'` \\ \\ || Y | \\|/ / // / - |__ `-,
/\@"\\ ` \\ `\\ | | ||/ // | \\/ \\ `-._`-,_.,
/ _.-. `.-\\,___/\\ _/|_/_\\_\\/|_/ | `-._._)
`-'``/ / | // \\__/\\__ / \\__/ \\
`-' /-\\/ | -| \\__ \\ |-' |
__/\\ / _/ \\/ __,-' ) ,' _|'
(((__/(((_.' ((___..-'((__,'
EOC

21
perl/cows/milk.cow Normal file
View File

@ -0,0 +1,21 @@
##
## Milk from Milk and Cheese
##
$the_cow = <<EOC;
$thoughts ____________
$thoughts |__________|
/ /\\
/ / \\
/___________/___/|
| | |
| ==\\ /== | |
| O O | \\ \\ |
| < | \\ \\|
/| | \\ \\
/ | \\_____/ | / /
/ /| | / /|
/||\\| | /||\\/
-------------|
| | | |
<__/ \\__>
EOC

14
perl/cows/moofasa.cow Normal file
View File

@ -0,0 +1,14 @@
##
## MOOfasa.
##
$the_cow = <<EOC;
$thoughts ____
$thoughts / \\
| ^__^ |
| ($eyes) |______
| (__) | )\\/\\
\\____/|----w |
|| ||
Moofasa
EOC

9
perl/cows/moose.cow Normal file
View File

@ -0,0 +1,9 @@
$the_cow = <<EOC;
$thoughts
$thoughts \\_\\_ _/_/
$thoughts \\__/
($eyes)\\_______
(__)\\ )\\/\\
$tongue ||----w |
|| ||
EOC

10
perl/cows/mutilated.cow Normal file
View File

@ -0,0 +1,10 @@
##
## A mutilated cow, from aspolito@csua.berkeley.edu
##
$the_cow = <<EOC;
$thoughts \\_______
v__v $thoughts \\ O )
($eyes) ||----w |
(__) || || \\/\\
$tongue
EOC

22
perl/cows/ren.cow Normal file
View File

@ -0,0 +1,22 @@
##
## Ren
##
$the_cow = <<EOC;
$thoughts
$thoughts
____
/# /_\\_
| |/o\\o\\
| \\\\_/_/
/ |_ |
| ||\\_ ~|
| ||| \\/
| |||_
\\// |
|| |
||_ \\
\\_| o|
/\\___/
/ ||||__
(___)_)
EOC

Some files were not shown because too many files have changed in this diff Show More