The city defines a dog as any living entity with four legs and a tail. So raccoons, bears, mountain lions, mice, these are all just different sizes of dog.
Given an ASCII-art image of an animal, determine if that animal is a dog.
Rules
An animal is a dog if it has four legs and a tail.
The foot of a leg starts with one of \
(backslash), |
(pipe), or /
(slash), has one or more _
in between, and another \
, |
, or /
. Each foot will hit the last line of the string. The feet may not share a common border.
\ \ | / / | | / | | / / <-- These are all just
|_| |___| |_____| |_____| |___| |_| different sizes of leg.
A tail is a line coming out of the left side of the figure and touching the leftmost part of the multiline string. The tail is made up of either -
or =
characters. The tail must be at least one character long, and can optionally end with a o
or *
.
o--- *-- *== -- == - = o=== *- <-- These are all just
different sizes of tail.
You can take input as a multiline string, or array of lines. Output a truthy or falsy value to determine if the figure is a dog, or any two distinct values.
Truthy test cases:
______/\__/\
_/ ( U U )
*--/____. ,\_ w _/
\ /| |\ |\ \
/_/ \_/|_| \_\
_________/\
o==/ ''>
|_||_||_||_|
/\__/\
( o O)
/ m/
| | don't ask
o-----| \__
| ___ \_______
//\ \ \___ ___ \
/_/ \_\ /_| \_|
Falsy test cases:
__________ _
______/ ________ \________/o)<
(_______/ \__________/
____/)(\
/ \o >o
( \_./
o--\ \_. /
\____/
|| ||
\/ \/
/\/\/\/\/\
o-/ o.o
/_/_/_/_/
-|_||_||_||_|
a dog? \$\endgroup\$