[Question]
  [
Some people count sheep to get to sleep. Others count goats.
Write a program or function that takes in a positive integer N and outputs N-1 awake goats followed by one sleeping goat, as if someone was counting N goats and at the very last one they fell asleep.
Awake goats look like this:
```
      \
  ___/o>
-(___)"
 '' ''
```
Sleeping goats look like this:
```
      \
  ___/->
,(___)"
 `` ``
```
They are chained together with a single space between beard and tail of adjacent goats:
```
      \       \       \
  ___/o>  ___/o>  ___/->
-(___)" -(___)" ,(___)"
 '' ''   '' ''   `` ``
```
The output is allowed to have trailing spaces and a single trailing newline.
**The shortest code in bytes wins.**
## Examples
N = 1:
```
      \
  ___/->
,(___)"
 `` ``
```
N = 2:
```
      \       \
  ___/o>  ___/->
-(___)" ,(___)"
 '' ''   `` ``
```
N = 3:
```
      \       \       \
  ___/o>  ___/o>  ___/->
-(___)" -(___)" ,(___)"
 '' ''   '' ''   `` ``
```
N = 4:
```
      \       \       \       \
  ___/o>  ___/o>  ___/o>  ___/->
-(___)" -(___)" -(___)" ,(___)"
 '' ''   '' ''   '' ''   `` ``
```
Larger N should work just as well.
  
[Answer]
# [MATL](http://github.com/lmendo/MATL), ~~56~~ 53 bytes
```
:"'!!((!((!!#*```).?p0```!!!]'8eP!P]'p(.' '.a-'XE&hqc
```
[Try it online!](http://matl.tryitonline.net/#code=OiInISEoKCEoKCEhIypgYGApLj9wMGBgYCEhIV0nOGVQIVBdJ3AoLicgJy5hLSdYRSZocWM&input=NA)
### Explanation
**Awake goat**
The awake goat can be packed into the string
```
  '' ''  ")___(->o/___   \
```
and unpacked as will be explained shortly. However, the single-quote symbols would need to be *duplicated* in order to escape them, so the string literal would have to be defined as (note the enclosing single-quote symbols and the duplication of the original ones):
```
'  '''' ''''  ")___(->o/___   \'
```
To save bytes, we define the string using characters *one code point above* that, thus avoiding duplication. The string literal becomes
```
'!!((!((!!#*```).?p0```!!!]'
```
At the end of the code we will subtract 1 and convert to char. (We could do it now, right after the string literal; but leaving it for the end will save another single-quote duplication, as we will see).
To explain how the string is unpacked, we will work with the original characters (that are produced at the end of the code by subtacting 1), so the explanation is easier to follow. We first reshape the string
```
  '' ''  ")___(->o/___   \
```
into an 8-row 2D char array, in *column-major order* (down, then across). This automatically pads the last column with char 0 (at the end of the code, subtracting 1 will transform it into number −1, which converted to char gives again char 0). Char 0 is displayed as a space. So effectively we are padding with spaces. The result of reshaping is
```
  > 
 "o\
')/ 
'__ 
 __ 
'__ 
'(  
 -  
```
We now flip vertically:
```
 -  
'(  
'__ 
 __ 
'__ 
')/ 
 "o\
  > 
```
and then transpose and flip vertically again to produce the awake goat:
```
      \ 
  ___/o>
-(___)" 
 '' ''  
```
The two flip operations are needed because the original packed string is "in reverse". This is to exploit the fact that the actual 2D char array representing the goat has 6 initial spaces in its first row, which get automatically filled by padding when the string is reshaped into an 8-row 2D array. But the padding is done at the end (not beginning) of the last column (not row), hence the flips and transpose.
**Sleeping goat**
A sleeping goat is generated from an awake goat by transliterating chars `o`, `'`, `-` into `-`, ```, `,` respectively. Actually, because of the one-code-point-above transformation, we transliterate chars `p`, `(`, `'` into `.`, `a`, `-`, which again saves us from having to duplicate the single-quote symbol. This is why the subtract-one operation was left for the end of the program.
**Code structure**
1. Generate an awake goat `N` times, working with code points increased by 1.
2. Transform the last goat into a sleeping goat.
3. Concatenate all goats horizontally. Subtract 1 to code points and cast to char.
**Commented code**
```
:                              % (Step 1) Implicitly input N. Push range [1 2 ... N]
"                              % For each (i.e. repeat N times)
  '!!((!((!!#*```).?p0```!!!]' %   Push this string. Quotes are escaped by duplicating
  8e                           %   Reshape into an 8-row 2D array of char, in
                               %   column-major order, padding last column with
                               %   char 0
  P                            %   Flip vertically
  !P                           %   Transpose and flip vertically
]                              % End
'p(.'                          % (Step 2) Push this string: source for transliteration
'.a-'                          % Push this string: target for transliteration
XE                             % Transliterate. Transforms last goat into sleeping
&h                             % (Step 3) Horizontally concat all 2D char arrays
qc                             % Subtract 1 and convert to char. 0 becomes −1, which
                               % is converted to char 0, which is displayed as a space
                               % Implicitly display 
```
[Answer]
## Javascript, 122 bytes
**Answer**
```
f=(n,r='repeat')=>'      \\ '[r](n--)+`
${'  ___/o>'[r](n)}  ___/->
${'-(___)" '[r](n)},(___)"
`+` '' ''  `[r](n)+' `` ``'
```
---
**Side note**  
In the following code (91 bytes) the goats are aligned verticaly.
It does not comply with the output format but i though it could be interesting to note that the horizontal alignment required in the output format needs more bytes:
```
f=n=>`
      \\
  ___/${--n?'o':'-'}>
${n?'-':','}(___)"
 ${n?'`` ``':`'' ''`}`+(n?f(n):'')
```
[Answer]
## Batch, 234 bytes
```
@echo off
set/pn=
call:l "      \ " "      \"
call:l "  ___/o]" "  ___/-]"
call:l "-(___)@ " ",(___)@"
call:l " '' ''  " " `` ``"
exit/b
:l
set s=%~2
for /l %%i in (2,1,%n%)do call set s=%~1%%s%%
set s=%s:@="%
echo %s:]=^>%
```
Takes input from stdin. Batch has trouble with `"` and `>` for various reasons so I have to use placeholders and then switch them at the end.
[Answer]
## Pyke, ~~56~~ 54 bytes
```
Fhqd6*"\
  ___/o>
-(___)
 '' ''"+23\":RI"-o'"",-`".:(P
```
[Try it here!](http://pyke.catbus.co.uk/?code=Fhqd6%2a%22%5C%0A++___%2Fo%3E%0A-%28___%29%0A+%27%27+%27%27%22%2B23%5C%22%3ARI%22-o%27%22%22%2C-%60%22.%3A%28P&input=3)
4 bytes too many because Pyke doesn't allow double quotes in strings :(
[Answer]
## JavaScript (ES6), ~~110~~ 109 bytes
```
f=
n=>`      \\       \\
  ___/o>  ___/->
-(___)" ,(___)"
 '' ''   `.replace(/^.{8}/gm,"$&".repeat(n-1))+"`` ``"
;
```
```
<input type=number min=1 oninput=o.textContent=f(this.value)><pre id=o>
```
Having to support all three kinds of quote characters was annoying, but fortunately @pinkfloydx33's comment gave me the flash of inspiration that I could add the backquotes at the end thus saving me 1 byte.
[Answer]
[# GolfScript](http://www.golfscript.com/golfscript/index.html), 91 bytes
```
~:a 1-:b;"      \\ "a*n"  ___/o>"b*"  ___/->"n"-(___)\" "b*",(___)\""n" '' ''  "b*" `` ``"n
```
Input: `3`
Output:
```
      \       \       \ 
  ___/o>  ___/o>  ___/->
-(___)" -(___)" ,(___)"
 '' ''   '' ''   `` ``
```
### Explanation
```
~:a 1-:b;      # Parse and save the input
"      \\ "a*n # Repeat the first line 'a' times
"  ___/o>"b*   # Repeat the head 'b' times
"  ___/->"n    # Then add the sleeping goat's head
"-(___)\" "b*  # Idem
",(___)\""n    #
" '' ''  "b*   # Idem
" `` ``"n      #
```
[Try it online!](http://golfscript.tryitonline.net/#code=fjphIDEtOmI7IiAgICAgIFxcICJhKm4iICBfX18vbz4iYioiICBfX18vLT4ibiItKF9fXylcIiAiYioiLChfX18pXCIibiIgJycgJycgICJiKiIgYGAgYGAibg&input=Mw)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~62~~ 56 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
⁶ẋ6;“\   ___/o>-(___)"  '' ''  ”s8
¢“-,o-'`”yÐ€
’1£ẋ€ż¢Y
```
Test it at [**TryItOnline**](https://tio.run/nexus/jelly#@/@ocdvDXd1m1o8a5sQoKCjEx8fr59vpagBpTSUFBXV1EFJ41DC32ILr0CKgIl2dfF31BKBA5eEJj5rWcD1qmGl4aDHQCCDn0KKjexwi////bwwA)
How?
```
⁶ẋ6;“\   ___/o>-(___)"  '' ''  ”s8 - Link 1: make a goat, niladic
⁶ẋ6                                - space character, ⁶, repeated 6 times
    “\   ___/o>-(___)"  '' ''  ”   - rest of the awake goat text
   ;                               - concatenate
                                s8 - split into length 8 parts
¢“-,o-'`”yÐ€ - Link 2: put a goat to sleep, niladic
¢            - last link (make a goat)
 “-,o-'`”    - characters to remap
         yÐ€ - map for each (change "-" into ",", "o" into "-", and "-" into "`"
’1£ẋ€ż¢Y - Main link: n
’        - decrement (nAwakeGoats)
 1£      - call link 1 as a nilad (make an awake goat)
   ẋ€    - repeat nAwakeGoats times
      ¢  - last link (make a sleeping goat)
     ż   - zip
       Y - join with line feeds
         - implicit print
```
[Answer]
## [Knight](https://github.com/knight-lang/knight-lang), 96 bytes
```
;O*"      \ "=n+0P;O+*+=t'  ___/''->'=l-nT+t'o>';O+*+','=t'(___)" 'l+'-'tO+*' `` ``  'l" '' ''"
```
Pretty simple, nothing super fancy—You just print out `n-1` versions of the sleeping goat and then the woke goat. Repeatable elements are saved in `t` so they aren't typed out again.
Expanded:
```
# Print out the ears. They're the same for both goat types.
; OUTPUT (* "      \ " (= n (+ 0 PROMPT)))
; OUTPUT
    (+
        (* (+ (= tmp '  ___/')'->') (= m - n TRUE))
        (+ tmp 'o>'))
; OUTPUT
    (+
        (* (+ ',' (= tmp '(___)" ')) m)
        (+ '-' tmp))
OUTPUT (+ (* ' `` ``  ' m) (" '' ''"))
```
[Answer]
# PHP , 200 Bytes
```
$a=["      \ ","  ___/o>",'-(___)" '," '' ''  "," `` ``  "];$z=8*$n=$argv[1];for($i=0;$i<4;)$o.=str_repeat($a[$i],$i++==3?$n-1:$n);$o[$z*2-2]="-";$o[$z*3-8]=",";$o.=$a[4];echo chunk_split($o,$z,"\n");
```
[Answer]
## C++, 180 bytes
```
auto f(int n)
{
string a,b,c,d;
while(n--)
{
a+="      \\ ";
b+="  ___/";b+=n?"o>":"->\n";
c+=n?"-(___)\" ":",(___)\" \n";
d+=n?R"( '' ''  )":" `` ``  \n";
}
return a+'\n'+b+c+d;
}
```
[Answer]
## [Pip](http://github.com/dloscutoff/pip), 60 + 1 = 61 bytes
One byte added for the `n` flag.
```
YsX6.\"\   ___/o>-(___)"  '' ''  \"<>8yXa-1.YyR^"-o'"Y^",-`"
```
Constructs an awake goat as a list of lines and yanks it into `y`. String-multiplies to get `a-1` awake goats. Replaces `-o'` with `,-`` in `y` and concatenates it to the end. Prints, newline-separated.
[Try it online!](http://pip.tryitonline.net/#code=WXNYNi5cIlwgICBfX18vbz4tKF9fXykiICAnJyAnJyAgXCI8Pjh5WGEtMS5ZeVJeIi1vJyJZXiIsLWAi&input=&args=LW4+Ng)
(I think this is my first time using Pip's escaped-string syntax `\"...\"`, which allows for literal double quotes in the string.)
[Answer]
# IBM/Lotus Notes Formula, ~~187~~ ~~174~~ 188 bytes ~~(not competing)~~
**EDIT** Found a space that shouldn't have been there and removed an unneeded @Implode
188 as I had missed the fact that the tail of the sleeping goat is different :-(
```
B:=@Repeat("      \\  ";a);C:=@Repeat("     /o> ";a-1)+"     /->";D:=@Repeat("  ---    ";a);E:=@Repeat(",(___)\"  ";a);F:=@Repeat(" `` ``   ";a);@Implode(B:C:D:E:F;@NewLine)
```
Ungolfed:
```
B:=@Repeat("      \\  ";a);
C:=@Repeat("     /o> ";a-1)+"     /->";
D:=@Repeat("  ---    ";a);
E:=@Repeat("`(___)\"  ";a-1)+",(___)\"  ";
F:=@Repeat(" `` ``   ";a);
@Implode(B:C:D:E:F;@NewLine)
```
Usage:
Create a Notes form with two fields named a and g.
a=editable, number, g=computed, text.
Paste the above formula into g and give a a default value of 0.
Set the form font to Terminal.
Create a new document with the form, enter a number in a and press F9 to update the goats.
Samples:
[![enter image description here](https://i.stack.imgur.com/qkSdn.png)](https://i.stack.imgur.com/qkSdn.png)
[![enter image description here](https://i.stack.imgur.com/SBy84.png)](https://i.stack.imgur.com/SBy84.png)
[![enter image description here](https://i.stack.imgur.com/MktLo.png)](https://i.stack.imgur.com/MktLo.png)
~~Not competing as the format messes up when the number of goats reaches the width of the page.~~ 
Given an infinitely wide screen it ~~should~~ will work for any number of goats ~~though~~. This is what it looks like when the page is not wide enough.
[![enter image description here](https://i.stack.imgur.com/AKlk4.png)](https://i.stack.imgur.com/AKlk4.png)
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 58 bytes
```
ri{S6*"\   ___/o>,(___)\"  '' ''  "+\{'o`"`-"er}|8/}%W%zN*
```
[Try it online!](https://tio.run/nexus/cjam#@1@UWR1spqUUo6CgEB8fr59vp6MBpDVjlBQU1NVBSEFJO6ZaPT9BKUFXKbWotsZCv1Y1XLXKT@v/fxMA "CJam – TIO Nexus")
**Explanation**
```
ri                               e# Read an integer from input
{                                e# Map the following block to the range 0..input-1
 S6*                             e#  Push 6 space characters
 "\   ___/o>,(___)\"  '' ''  "+  e#  Push this string and concatenate with the spaces
 \                               e#  Bring the number being mapped to the top
 {                               e#  If it's 0, execute this block:
  'o`                            e#   Push the string "'o"
  "`-"                           e#   Push the string "`-"
  er                             e#   Transliterate the large string by replacing characters
                                 e#    from "'o" with respective characters from "`-"; this
                                 e#    makes the sleeping goat.
 }|                              e#  (end if)
 8/                              e#  Split the string into chunks of length 8
}%                               e# (end map)
W%                               e# Reverse the array, since the sleeping goat was made at 
                                 e#  the beginning
z                                e# Transpose
N*                               e# Join with newlines
```
[Answer]
# Python 2.7, 101 113 bytes
Edit: Added function definition
```
def f(n):
 m=n-1
 print "      \ "*n+"\n"+"  ___/o>"*m+"  ___/->\n"+'-(___)" '*n+"\n"+" '' ''  "*m+" ``"*2
```
de-golfified:
```
m=n-1              # Replacement variable. Saves 6 bytes
"      \ "*n+"\n"+ # Print ears, same for all goats!
"  ___/o>"*m+      # Print eyes of n-1 awake goat
"  ___/->\n"+      # Print eye of sleeping goat
'-(___)" '*m+      # Print body of n-1 awake goat
',(___)"\n'+       # Print body of sleeping goat
+" '' ''  "*m+     # Print the legs of n-1 awake goat
" ``"*2            # Print legs of sleeping goat using *2 operator to save 1 byte
```
Note Python2.7 is one byte shorter than Python3 due to that it doesn't need parentesis when printing.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 66 bytes
```
’      \ 0  ___/1>02(___)" 0 33 33  ’0¡v123SDys…o-'S:I<×?ys…-,`S:,
```
[Try it online!](https://tio.run/##MzBNTDJM/f//UcNMBTCIUTBQUIiPj9c3tDMw0gAyNJWAIsbGIKQAVGVwaGGZoZFxsEtl8aOGZfm66sFWnjaHp9uDubo6CcFWOv//GwMA "05AB1E – Try It Online")
### Explanation
```
’      \ 0  ___/1>02(___)" 0 33 33  ’0¡v123SDys…o-'S:I<×?ys…-,`S:,   Argument n
’      \ 0  ___/1>02(___)" 0 33 33  ’   The goat, newline replaced by 0 and the eye replaced by 1
0¡                              Split on 0
  v                             For each y in array, do:
   123SD                          Push the array [1,2,3] twice
        ys…o-'S:                  Replace [1,2,3] with ['o','-','\'']
                I<×?              Print that n-1 times without newline
                    ys…-,`S:,     Replace [1,2,3] with ['-',',','`'] and print
```
[Answer]
# [Perl 5](https://www.perl.org/) `-n`, 105 bytes
```
say for'      \\ 'x(--$_+1),
'  ___/o>'x$_.'  ___/->',
'-(___)" 'x$_.',(___)" ',
" '' ''  "x$_.' `` ``  '
```
[Try it online!](https://tio.run/##K0gtyjH9/784sVIhLb9IXQEMYmIU1Cs0dHVV4rUNNXW4gKLx8fH6@XbqFSrxelCerp06UEZXA8jWVFKAyOjAeDpcQEIdhBSUIHoSEkBIQf3/f@N/@QUlmfl5xf91fU31DAwN/uvmAQA "Perl 5 – Try It Online")
[Answer]
# Bash + GNU Coreutils, ~~165~~ 155 bytes
```
a=" \      
>o/___  
 \")___(-
  '' '' "
eval paste -d \'\' $(seq $1|while read;do
printf '<(echo "$a") '
done) | sed "s/-/,/;s/o/-/;s/'' ''/"'`` ``/'|rev
```
Run with: 
```
bash my_pgm.bash N
```
Basically the program prints N times of the same goat (reversed), and substitutes the first `-`, for `,`, the first `o` for `-` and the first `'' ''` for the backticks. Then reverses the lines.
[Answer]
# PHP, ~~133~~ 131 bytes
```
for(;$y<32;$y+=8)for($x=$argv[1];$x--;)echo substr("      \   ___/".($x?"o>-(___)\"  '' ''  ":"->,(___)\"  `` ``  "),$y,8),"
"[$x];
```
I found two bytes to golf away from one of the version without curlys.
[Answer]
## PowerShell v2+, 96 bytes
```
param($n)'      \ '*$n--
'  ___/o>'*$n+'  ___/->'
'-(___)" '*$n+',(___)"'
" '' ''  "*$n+' `` ``'
```
(ab)uses the default `Write-Output` formatting to include a newline between elements. Leverages string concatenation and multiplication to construct the goats line by line. The only real trick is the first line `$n--` to output the correct number of ears and then post-decrement `$n` so it's correct for the rest of the lines.
```
PS C:\Tools\Scripts\golfing>  1..4|%{.\counting-goats-to-sleep.ps1 $_}
      \ 
  ___/->
,(___)"
 `` ``
      \       \ 
  ___/o>  ___/->
-(___)" ,(___)"
 '' ''   `` ``
      \       \       \ 
  ___/o>  ___/o>  ___/->
-(___)" -(___)" ,(___)"
 '' ''   '' ''   `` ``
      \       \       \       \ 
  ___/o>  ___/o>  ___/o>  ___/->
-(___)" -(___)" -(___)" ,(___)"
 '' ''   '' ''   '' ''   `` ``
```
[Answer]
## Ruby, 102 bytes
```
m=-1+n=gets.to_i
puts'      \ '*n,'  ___/o>'*m+'  ___/->',(?-+a='(___)" ')*m+?,+a," '' ''  "*m+" ``"*2
```
[Answer]
# Python 3. 170 bytes
```
lambda n:'\n'.join(map(lambda*l:''.join(l),*map(lambda w:(' '*6+'\ ','  ___/'+(w and'o'or'-')+'>',(w and'-'or',')+'(___)" ',w and" '' ''  "or' `` ``  '),range(n)[::-1])))
```
hmm, apparently constructing the string without doing list manipulation yield shorter code
[Answer]
## Emacs Lisp, 241 bytes
```
(defvar s'("     \\""  ___/->"",(___)\""" `` ``"))(defun a()(dotimes(n 4 g)(setf(nth n g)(format"%s%s"(nth n'("     \\  ""  ___/o>""-(___)\" "" '' ''  "))(nth n g)))))(defun g(n)(let((g(copy-seq s)))(mapcar'message(dotimes(i(- n 1)g)(a)))))
```
"Slightly ungolfed"
```
(defvar s'("     \\""  ___/->"",(___)\""" `` ``"))
(defun a()(dotimes(n 4 g)(setf(nth n g)(format"%s%s"(nth n'("     \\  ""  ___/o>""-(___)\" "" '' ''  "))(nth n g)))))
(defun g(n)(let((g(copy-seq s)))(mapcar'message(dotimes(i(- n 1)g)(a)))))
```
where `s` is one sleeping goat, `a` adds an awake goat and `g(n)` is the counting function.
[Answer]
# Java 8, ~~236~~ ~~222~~ ~~218~~ 173 bytes
```
n->{String x="\n",a="",b=a,c=a,d=a;for(;n-->0;a+="      \\ ",b+="  ___/"+(n<1?"-":"o")+">",c+=(n<1?",":"-")+"(   )\" ")d+=(n<1?" `` ``":" '' ''")+"  ";return a+x+b+x+c+x+d;}
```
**Explanation:**
[Try it online.](https://tio.run/##NVBBbsIwELznFaO9kMgxpZceakxfUC49NhUYJ1SmsEGJQVQob083JLVmDjs7K3nm4K5O1@eKD@VP74@ubfHuAt8TIHCsmr3zFdbDCHzEJvA3fCobcGZE7ISCNroYPNZgWPSsV/fJe7NUMOXOEuU763IvLK0z@7pJDWu9WhinLOHxigLieoybzeaJVMrL5zfS9Eo1ZYpWlHtlRzEXUQ9iKodZQaCs/N9huxWIAbOZYHABZJoqXhqGUze1E3phabreJBLgfNkdJcCU41qHEiepIR1jfH7BZWMHw8eH@EGCLgyUCljixUxb6ei3jdVpXl/i/Cyn8cgpz6Wx7FHXWFiXdP0f)
```
n->{                                // Method with integer parameter and String return-type
  String x="\n",                    //  New-line String to reduce bytes
         a="",                      //  Row 1 String, starting empty
         b=a,                       //  Row 2 String, starting empty
         c=a,                       //  Row 3 String, starting empty
         d=a;                       //  Row 4 String, starting empty
  for(;n-->0;                       //  Loop `n` times:
    a+="      \\ ",                 //   Append the horns to row 1
    b+="  ___/"+(n<1?"-":"o")+">",  //   Append the back and head to row 2
    c+=(n<1?",":"-")+"(   )\" ")    //   Append the tail, body, and beard to row 3
    d+=(n<1?" `` ``":" '' ''")+"  ";//   Append the legs to row 4
  return a+x+b+x+c+x+d;}            //  Return the four rows, separated by new-lines
```
[Answer]
# [Canvas](https://github.com/dzaima/Canvas), ~~58~~ 39 [bytes](https://github.com/dzaima/Canvas/blob/master/files/chartable.md)
```
！－≥９A²］]ｋ１｛｛K４ｅdｒ↙FX‟×-２２╋,８３╋`` ``３４╋↔
```
[Try it here!](https://dzaima.github.io/Canvas/?u=JXVGRjAxJXVGRjBEJXUyMjY1JXVGRjE5QSVCMiV1RkYzRCU1RCV1RkY0QiV1RkYxMSV1RkY1QiV1RkY1QksldUZGMTQldUZGNDVkJXVGRjUyJXUyMTk5RlgldTIwMUYlRDctJXVGRjEyJXVGRjEyJXUyNTRCJTJDJXVGRjE4JXVGRjEzJXUyNTRCJTYwJTYwJTIwJTYwJTYwJXVGRjEzJXVGRjE0JXUyNTRCJXUyMTk0,i=OQ__,v=8)
Constructs the awake goat facing left from a compressed string, repeats it \$n\$ times horizontally, modifies the left-most goat to the sleeping goat, then flips the whole string horizontally.
[Answer]
# Brainfuck 420 bytes
Its not very golfed yet... but it works... whit numbers from 0 to 255 :)
```
>+[[-]>,[+[-----------[>[-]++++++[<------>-]<--<<[->>++++++++++<<]>>[-<<+>>]<+>]]]<]<[->+>+>+>+<<<<]>>>>>>++++[<++++++++>-]>-[<+>---]<+++++++>>-[<+>-----]<---->>-[<-->-------]<+>>----[<+>----]<-><<<<<<[>......>.<.<-]++++++++++.>>+++<<<-[>>..>...>.>.>.<<<<<<-]>>..>...>.--.>>.[<]>.<<-[>>>>>.-----.<...>+.++++<<++.--.<<<-]>>>>>-.----.<...>+.<<++.--.>>[-<<<<+>>>>]<[<]>-->.<<<-[>>>>.<<..>>.<<..>>..<<<<-]>>>>>+<.>..<.>..<..
```
[Try it online](https://tio.run/##TVDLCgIxDPygmoCeh/xIyEEFQQQPgt9fJ8l21ynbdqeTyeP2uT7fj@/9NacNdwk7@XA54EZyFBxNmQRvgIvZ2AGEUQsMs@AWEYjUjF5AKRJttgJpZ8Jfo3Us1nZKKhuzJpPJZSNTkwVuMqoMBTctmEKxik9opaaCXVm@55er41jHzopQrM6KteWEVmKaUjC0e6ZpUh1MiP5r1nsPpkaTw0lbdqJY1rypHofiMBzIirZN5zxffg)
Explained version:
```
Read number from 0 to 255 "thanks to esolangs ;)"
>+[[-]>,[+[-----------[>[-]++++++[<------>-]<--<<[->>++++++++++<<]>>[-<<+>>]<+>]]]<]< 
Its a little bit hard explain this part because it is creating letters and printing lines 
at the same time
[->+>+>+>+<<<<]                              Make 4 copies of the number (one for every line)
>>>>>>++++[<++++++++>-]>-[<+>---]<+++++++>   Make space and '\'
>-[<+>-----]<----                            Make '/'
>>-[<-->-------]<+                           Make 'o'
>>----[<+>----]<->                           Make mayor sign
<<<<<<[>......>.<.<-]                        Print first line
++++++++++.>>+++<<                           Make line jump and '_'
<-[>>..>...>.>.>.<<<<<<-]                    Print second line
>>..>...>.--.>>.[<]                          Make minus sign and print the line of last sheep
>.<<-[>>>>>.-----.<...>+.++++<<++.--.<<<-]   Print thirth line
>>>>>-.----.<...>+.<<++.--.>>[-<<<<+>>>>]    Print the line of last sheep
<[<]>-->.<<<-[>>>>.<<..>>.<<..>>..<<<<-]     Print fourth line
>>>>>+<.>..<.>..<..                          Print the line of last sheep
```
[Answer]
# [Zsh](https://www.zsh.org/), 97 bytes
```
$1()O+=${s/o/-}
for s ('      \ '
"  ___/o>"
'-(___)" '
" '' ''  ")(eval {1..$1}'||O+=$s;';<<<$O)
```
[Try it online!](https://tio.run/##qyrO@F@cWqJg@l/FUEPTX9tWpbpYP19ft5YrLb9IoVhBQ10BDGIU1LmUFBTi4@P18@2UuNR1NYBMTSWwqLo6CCkoaWqkliXmKFQb6umpGNaq19SAjCu2Vre2sbFR8df8/x8A "Zsh – Try It Online")
Feels way too long.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~63~~ 61 bytes
```
•D:¨Mß²нĀùÜ<3¹º•“\ 
_/o>-()"'“ÅвJ.B×»R"-, o-"#vy`.;2F„'``.;]R
```
[Try it online!](https://tio.run/##yy9OTMpM/f//UcMiF6tDK3wPzz@06cLeIw2Hdx6eY2N8aOehXUCZRw1zYhS44vXz7XQ1NJXUgdzDrRc2eek5HZ5@aHeQkq6OQr6uknJZZYKetZHbo4Z56glAVmzQ//@GBgA "05AB1E – Try It Online")
```
•...•“...“ÅвJ.B×»R"..."#vy`.;2F„'``.;]R  # trimmed program
                                      R  # push reversed...
             .B                          # list of lines in...
            J                            # joined...
          Åв                             # list of characters in...
     “...“                               # literal...
          Åв                             # with indices in base-10 values of base length of...
     “...“                               # literal...
          Åв                             # digits of...
•...•                                    # 258955905826915235144641900393055...
             .B                          # with length of longest line minus length of each line spaces appended to each line...
                                         # (implicit) with each element...
               ×                         # repeated...
                                         # implicit input...
               ×                         # times...
                »                        # joined by newlines...
                 R                       # reversed...
                           .;            # with first occurence of...
                          `              # second character of...
                         y               # variable...
                           .;            # replaced by...
                          `              # first character of...
                         y               # variable...
                        v                # for y in...
                  "..."                  # literal...
                       #                 # split by spaces...
                                   .;    # with first occurence of...
                                  `      # second character of...
                               „'`       # literal...
                                   .;    # replaced by...
                                  `      # first character of...
                               „'`       # literal...
                              F          # for n in [0, 1, 2, ...,
                             2           # ..., literal...
                              F          # ]
                                     ]   # exit loop
                                     ]   # exit loop
                                         # implicit output
```
]