[Question]
  [
I suddenly really want to play tennis, but alas I do not have a court!
Surprise! This is where you come in.
You have to print a tennis court for me, but you have to do it in the fewest bytes possible because of confidential reasons. 
## Tennis court
```
---------
|       |
---------
|   |   |
xxxxxxxxx
|   |   |
---------
|       |
---------
```
## This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest code in bytes wins!
  
[Answer]
# Python 2, 65 bytes
```
s='-','|'+' '*7,'-','|   ','x'
for i in s+s[3::-1]:print(i*9)[:9]
```
Flp.Tkc saved a byte.
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~29~~ ~~27~~ 26 bytes
```
'-9×©'|ð4×«Dûs®s¨¨ûû'x5×»û
```
[Try it online!](http://05ab1e.tryitonline.net/#code=Jy05w5fCqSd8w7A0w5fCq0TDu3PCrnPCqMKow7vDuyd4NcOXwrvDuw&input=)
```
'-9×©                      Push "---------" and store it as temporary value
     '|ð4×«Dûs             Push palindromized("|    ") = "|       |"
                           and push "|    "
              ®            Push "---------" again
               s¨¨û        Strip the last 2 characters from "|    " and push palindromized("|  ") = "|   |"
                   û       Palindromize last item -> "|   |   |"
                    'x5×   Push "xxxxx"
                        »  Join everything with newlines
                         û Palindromize the result and implicitly display it
```
[Answer]
# Python 3 - ~~73~~ 72 bytes
```
d=b,a,c='|       |','-'*9,'|   |   |'
print(a,*d,'x'*9,c,a,b,a,sep='\n')
```
**Python 3.6** - 75 bytes
```
x=f"{'-'*9}\n|{' '*7}|\n{'-'*9}\n|   |   |\n"
print(x,'x'*9,x[::-1],sep='')
```
Credit goes to [flp-tkc](https://codegolf.stackexchange.com/users/60919/flp-tkc). Thank you :)
[Try here!](https://repl.it/EszP/2)
[Answer]
# [///](https://esolangs.org/wiki////), ~~64~~ 56 bytes
```
/f/---//e/   //a/fff
|ee |
fff
//d/|e|e|
/adxxxxxxxxx
da
```
[Try it online!](https://tio.run/nexus/slashes#NcaxDQAxCMXQnilYAHkmJPgzpGB3kivOr/EiIgIad4dEkk23j30HxfRjZJ0/q9y9 "/// – TIO Nexus")
Another 56 byte solution:
```
/f/---//e/|   //a/fff
e    |
fff
//d/ee|
/adxxxxxxxxx
da
```
[Answer]
# [V](https://github.com/DJMcMayhem/V), 25 bytes
```
9é-ÄÙÒ r|$.4äGMãlr|jj.kÒX
```
[Try it online!](https://tio.run/nexus/v#ASMA3P//OcOpLcOEw5nDkiByfCQuNMOkR03Do2xyfGpqLmvDklj//w "V – TIO Nexus")
This should be 23 bytes:
```
9é-ÄÙÒ r|$.4äMÒXãkr|jj.
```
But I ran into several bugs while creating it. :(
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 25 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
“¡⁵÷ḞȯḤɼ’b4ị“- x|”s5ŒBŒḄY
```
**[TryItOnline!](http://jelly.tryitonline.net/#code=4oCcwqHigbXDt-G4nsiv4bikybzigJliNOG7i-KAnC0geHzigJ1zNcWSQsWS4biEWQ&input=)**
I had hoped to use the 1,3,1 quarter court repetition, but can't squeeze that into less (a raw version being 28: `“ßṂuB’b4s3x“¢¤¢‘ị“- x|”ŒBŒḄY`).
### How?
```
“¡⁵÷ḞȯḤɼ’b4ị“- x|”s5ŒBŒḄY - Main link: no arguments
“¡⁵÷ḞȯḤɼ’                 - base 250 number: 375116358919167
         b4               - convert to base 4:
                                [1,1,1,1,1,0,2,2,2,2,1,1,1,1,1,0,2,2,2,0,3,3,3,3,3]
           ị“- x|”        - index into character list "- x|" (1-based):
                                "-----|    -----|   |xxxxx"
                  s5      - split into chunks of length 5:
                               ["-----","|    ","-----","|   |","xxxxx"]
                    ŒB    - bounce (vectorises):
                               ["---------","|        |","---------","|   |   |","xxxxxxxxx"]
                      ŒḄ  - bounce (non-vectorising version):
                               ["---------","|        |","---------","|   |   |","xxxxxxxxx","|   |   |","---------","|        |","---------"]
                        Y - join with line feeds:
                          - implicit print
```
[Answer]
# J, ~~70~~ ~~54~~ ~~51~~ 50 bytes
*Saved a byte thanks to Zgarb!*
```
9 9$'-| |-| | |x| | |'#~3 9 1 7{~4#.inv 1851926050
```
Some standard compression technique, using a compressed RLE.
```
   9 9$'-| |-| | |x| | |'#~3 9 1 7{~4#.inv 1851926050
---------
|       |
---------
|   |   |
xxxxxxxxx
|   |   |
---------
|       |
---------
```
[Answer]
# Ruby, 60 bytes
```
-4.upto(4){|i|puts''.rjust(9,%w{x |%3s - |%7s -}[i.abs]%'')}
```
**Ungolfed**
```
-4.upto(4){|i|                    #iterate -4 to 4.
   puts''.rjust(9,                #Print the null string right justified to length 9 padded by repititions of
   %w{x |%3s - |%7s -}[i.abs]%'') #the string from the %w{} array modified like sprintf by the % operator
}                                 #so that %Ns is replaced by N spaces.
```
[Answer]
# bash/Unix tools, ~~58~~ 57 bytes
```
dc<<<4o16i3FFFFp20002prp20202p15555pszpszfp|tr 0-3 ' x|-'
```
Only four characters other than newline appear in the desired output, allowing each line to be coded as a base-4 number. These numbers are then written in hexadecimal in the script, for brevity.
The Unix calculator dc is used both for the base-16 to base-4 conversion and for stack manipulation to allow easy repetition of lines in the right places.
*Edit:* Shaved one byte off by swapping two of the base-4 digits used to code characters, permitting the tr command to be one byte shorter than the previous version.
[Answer]
## JavaScript, 85 bytes
```
console.log('---|  ---| |xxx| |---|  ---'.replace(/(.)((.).)/g,'$1$3$3$2$3$3$3$1\n'))
```
[Answer]
## JavaScript (ES6), ~~86~~ ~~84~~ ~~83~~ 81 bytes
*Saved 2 bytes, thanks to Neil*
```
a=`---------
`;a+=`|       |
`+a;b=`|   |   |
`;console.log(a+b+`xxxxxxxxx
`+b+a)
```
### Alternate method #1, 93 bytes
```
console.log('01232101242421512424210123210'.replace(/./g,n=>`-
|  x`[n].repeat('911739'[n])))
```
### Alternate method #2, 86 bytes
Suggested by Neil:
```
console.log(`-${s=`
       |
-
   |
`}x${s}-`.replace(/.*/g,s=>s.repeat(9).slice(-9)))
```
### Alternate method #3, 91 bytes
A recursive approach:
```
console.log((f=(n,c=`xxxx
|   |   |
---------
|       |
`[n]||'-')=>~n--?c+f(n)+c:'x')(43))
```
[Answer]
# [SOGL 0.5](https://github.com/dzaima/SOGL), ~~24~~ ~~23~~ 20 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md) (non-competing)
```
 -9*"D√⅜‘⁴"Hοr‘¹q x9*o±
```
Explanation:
```
"'|⁶.f,‘9n_h¹q x9*o±
"'|⁶.f,‘              pushes "------------------|       ||   |   |"
        9n            splits into chunks of 9
                       stack: [["---------","---------","|       |","|   |   |"]]
          _           puts all the contents of the array into the stack
                       stack: ["---------","|       |","---------","|   |   |"]
           h          swaps the 2nd from top with 3rd from top
            ¹         turns back into array
                       stack: [["---------","|       |","---------","|   |   |"]]
             q        outputs the array without popping it from stack
               x      push "x"
                       stack: [["---------","|       |","---------","|   |   |"], "x"]
                9*    repeat it 9 times
                       stack: [["---------","|       |","---------","|   |   |"], "xxxxxxxxx"]
                  o   output that
                   ±  reverse the array
implicitly output the reversed array
```
So how does the compressed string work?
The string converted from base250 to binary is
`1000000100111110010100001110100000001100010001`
and approxametally what it does:
```
100 boxstring (a custom dictionary string with chars " -/\|_\n")
000010 choose only the "-"s
01111 with length of 15+(different chars used)+2 = 18 chars
there is only 1 char type, so results in "------------------"
100 another boxsting
101000 choosing " " and "|"
01110 with length of 14+(different chars used)+2 = 18 chars
100000001100010001 the data; 0 = " " and 1 = "|"
has "------------------" and "|       ||   |   |" and just joins them together
```
non-competing, because language postdates the challenge. And this challenge is only a day old. I knew I should've put something up yesterday. I did this as a test for my language and it ended up too good not to post. Pretty sure this is golfable more too.
[Answer]
# [///](https://esolangs.org/wiki////), 59 bytes
```
/_/---------
//s/   /_|ss |
_|s|s|
xxxxxxxxx
|s|s|
_|ss |
_
```
[Try it online!](https://tio.run/nexus/slashes#@68fr68LA1z6@sX6CgoK@vE1xcUKNVxACgi5KmCAC8KHyf7/DwA "/// – TIO Nexus")
[Outgolfed...](//ppcg.lol/a/103607/41024)
[Answer]
# Javascript (ES6), 86 bytes:
```
a=`---------
|       |
---------`;b=`|   |   |
`;console.log(a+`
`+b+`xxxxxxxxx
`+b+a)
```
Test here:
```
a=`---------
|       |
---------`;b=`|   |   |
`;console.log(a+`
`+b+`xxxxxxxxx
`+b+a)
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), 26 bytes
```
'-5×©'|4úD®sÂðñ)í€û»'x5×»û
```
Uses the **CP-1252** encoding. [Try it online!](http://05ab1e.tryitonline.net/#code=Jy01w5fCqSd8NMO6RMKuc8OCw7DDsSnDreKCrMO7wrsneDXDl8K7w7s&input=)
[Answer]
# PHP, ~~66~~ 62 bytes
This is the original answer (66 bytes):
```
<?=$a="---------
|       |
---------
|   |   |
xxxx",x,strrev($a);
```
It generates a notice because of the unknown constant `x`. The notice can be suppressed by setting `error_reporting=0` in `php.ini` or in the command line:
```
$ php -d error_reporting=0 tennis.php
```
The last line of the output doesn't end with a newline character.
---
The updated answer (62 bytes), improving an improvement suggested by @Titus:
```
<?=$a=($b="---------
|   ")."    |
$b|   |
xxxx",x,strrev($a);
```
Run it without a configuration file (it defaults with `error_reporting=0` this way):
```
$ php -n tennis.php
```
Both versions of the code contain literal new lines embedded in the string (1 byte shorter than `\n`) and cannot we unwrapped.
[Answer]
# PHP, 72 bytes
```
<?=$a="---------
",$b="|       |
$a",$c="|   |   |
","xxxxxxxxx
$c$a$b";
```
I almost hate it when it´s shorter like this than with calculating a little.
[Answer]
# Ruby, 52 bytes
```
puts [b=[a=?-*9,"|%8s"%?|,a],c="|   |   |",?x*9,c,b]
```
Using the double simmetry, the lines are: `0-1-0 / 2-3-2 / 0-1-0`, the loop can be easily unrolled and the nested list is flattened on output.
[Answer]
## Pyke, ~~28~~ ~~26~~ 25 bytes
```
\|ddsssd7*.X--||"R\x5*nJs
```
[Try it here!](http://pyke.catbus.co.uk/?code=%5C%7Cddsssd7%2a.X--%7C%7C%22R%5Cx5%2anJs)
```
       d7*                -    " " * 7
          .X--||"         -   grid(^, corners="-", sides="-", left="|", right="|")
\|dds                     -     "|  "
     s                    -    palindromise(^)
      s                   -   palindromise(^)
                  \x5*    -   "x" * 5
                      nJ  -  "\n".join(^)
                        s - palindromise(^)
```
[Answer]
# 05AB1E, 25 bytes
```
'-9×©'|ð4×«û®…|  ûû'x5×»û
```
Uses the **CP-1252** encoding. [Try it online!](https://tio.run/#MlEsh)
Explanation:
```
'-9×                       # Push "---------"
    ©                      # Store in register_c
     '|ð4×«                # Push "|    "
           û               # Palindromize, giving "|       |"
            ®              # Retrieve from register_c
             …|            # Push "|  "
                 ûû        # Palindromize twice, giving "|   |   |"
                   'x5×    # Push "xxxxx"
                       »   # Join by newlines
                        û  # Palindromize
                           # Implicit print
```
[Answer]
# Vim, 32 bytes
```
9i-^[Y3pO||^[7i ^[YGPkP4lr|YpO^[9ix^[
```
This will print the tennis court into a vim buffer. `^M` represents the Enter key (0x0d) and `^[` is the Escape key (0x1b). You can run these keystrokes/code by saving them to a file and running
```
vim -s <filename> -u NONE
```
### Printing to stdout
If it has to be printed to stdout instead, you could save the buffer to a file (I used "a") and use whichever shell `vim` is set to use (I used `bash`) as well as the `cat` program in order to print the tennis court to stdout (51 bytes):
```
9i-^[Y3pO||^[7i ^[YGPkP4lr|YpO^[9ix^[:w!a|sil !cat %^M:q^M
```
It's the same as the earlier version but with `:w!a|sil !cat %^M:q^M` added onto the end
[Answer]
## J, 36 bytes
```
9$'-'([,(' '4}]),[,],'x',:])9$'|   '
```
This works on the REPL, which is the standard way of using J:
```
   9$'-'([,(' '4}]),[,],'x',:])9$'|   '
---------
|       |
---------
|   |   |
xxxxxxxxx
|   |   |
---------
|       |
---------
```
With **41 bytes**, I can print the result to STDOUT:
```
echo 9$'-'([,(' '4}]),[,],'x',:])9$'|   '
```
[Try it online!](https://tio.run/nexus/j#@5@anJGvYKmirquuEa2joa6gblIbq6kTrROro16hrmMVqwmUq1FQUFD//x8A "J – TIO Nexus")
## Explanation
I construct the tennis court one row at a time.
```
9$'-'([,(' '4}]),[,],'x',:])9$'|   '
                            9$'|   '  The string repeated to length 9: y = '|   |   |'
  '-'(                     )          Apply this verb to x = '-' and y:
                     'x',:]            y with a row of 'x'-chars above it.
                                       This is a 2x9 matrix, and "," now works by
                                       prepending new rows to it.
                   ],                  Prepend another y.
                 [,                    Prepend x, which is repeated to a row of length 9.
        (' '4}]),                      Prepend y with 4th character replaced by a space.
      [,                               Prepend x again.
                                      Now we have this 6x9 matrix:
                                       ---------
                                       |       |
                                       ---------
                                       |   |   |
                                       xxxxxxxxx
                                       |   |   | 
9$                                    Repeat it to have 9 rows.
```
[Answer]
# [PowerShell](https://github.com/PowerShell/PowerShell), ~~67~~ 66 bytes
```
($a='-'*9)
($b="|       |")
$a
($c="|   "*2+"|")
'x'*9
$c
$a
$b
$a
```
[Try it online!](https://tio.run/nexus/powershell#@6@hkmirrquuZanJpaGSZKtUowABNUqaXCqJQLFkiJiSlpG2EkhQvQKomEslGSSrkgQk//8HAA "PowerShell – TIO Nexus")
Just some string multiplication, setting variables, and ensuring they're encapsulated in parens to place copies on the pipeline. The default `Write-Output` at program completion gives us newlines between for free.
*Thanks to @ConnorLSW for saving an obvious byte.*
[Answer]
# [Canvas](https://github.com/dzaima/Canvas), 13 [bytes](https://github.com/dzaima/Canvas/blob/master/files/chartable.md)
```
Ａ←⁹ｗ５+7ｑ⁴‟５ｎ┼
```
[Try it here!](https://dzaima.github.io/Canvas/?u=JXVGRjIxJXUyMTkwJXUyMDc5JXVGRjU3JXVGRjE1KzcldUZGNTEldTIwNzQldTIwMUYldUZGMTUldUZGNEUldTI1M0M_,v=8)
[Answer]
# Python 2, 75 bytes
```
a,b,c='-'*9,'|       |','|   |   |'
for e in[a,b,a,c,'x'*9,c,a,b,a]:print e
```
Uses variables borrowed from @GurupadMamadapur
Alternative also for 75
```
a,b,c='-'*9,'|       |','|   |   |'
print'\n'.join([a,b,a,c,'x'*9,c,a,b,a])
```
[Answer]
# Emacs, ~~43~~ 35 keystrokes
`M-9` `x` `RET` : nine x's, return  
`C-SPC` : set mark  
`|` `M-3` `SPC` `|` `M-3` `SPC` `|` `RET` : pipe, three spaces, pipe, three spaces, pipe, return  
`M-9` `-` `RET` : nine hyphens, return  
`|` `M-7` `SPC` `|` `RET` : pipe, seven spaces, pipe, return  
`M-9` `-` `RET` : nine hyphens, return  
`C-x` `C-x` : exchange point and mark, selecting region  
`M-w` : copy region  
`C-p` : previous line  
`C-y` : yank copied text  
`M-x` `rev-r` `RET` : execute `reverse-region` command  
[Answer]
# Lua, 82 Bytes.
```
y=[[---------
|       |
---------
]]z="|   |   |\n"io.write(y,z,"xxxxxxxxx\n",z,y)
```
I tried many methods, and yet this one proved the victor.
[Answer]
# [Pushy](https://github.com/FTcode/Pushy), 33 bytes
This question had 33 upvotes, and there were 33 answers, so I just had to post a 33 byte solution...
```
9:45;T`|    `wT`|   |`4dT5:120;w"
```
[**Try it online!**](https://tio.run/nexus/pushy#@29pZWJqHZJQowAECeUQRk2CSUqIqZWhkYF1udL//wA)
---
## Explanation
The code can be split into several parts, to make it easier to understand. The first part works like so:
```
9:45;    \ Push the char '-' 9 times
T        \ Push 10, which is a linefeed
`|    `  \ Push these charcodes
```
The stack is now:
```
---------
|
```
The mirror operator, `w`, then mirrors the whole stack, producing:
```
---------
|       |
---------
```
Then:
```
T        \ Push a linefeed
`|   |`  \ Push these chars
4d       \ Copy the last 4 characters
T        \ Push a linefeed
5:120;   \ Push the char 'x', 5 times
```
The stack is now beginning to look like the tennis court:
```
---------
|       |
---------
|   |   |
xxxxx
```
To finish it, we use the mirror operator `w` once more, which reflects this string to produce the full tennis court.
```
---------
|       |
---------
|   |   |
xxxxxxxxx
|   |   |
---------
|       |
---------
```
All that's left now is to print, which is done by the `"` character.
[Answer]
**Unix Shell; using dc and tr; 55 Bytes:**
( Optimization of Mitchell Spector solution )
```
dc<<<4o16i3FFFFp20002prp20202p15555psrfrp|tr 0-3 ' x|-'
```
**Others Solutions :
Using sed; 81 Bytes;**
```
echo "---|  ---| |xxx| |---|  ---"|sed "s/\(.\)\(.\)\(.\)/\1\2\2\2\3\2\2\2\1\n/g"
```
**Using dc in function : 88 Bytes**
```
b(){ dc<<<2o16i1${1}p|tr '01' ' '$2;};(b FF -;b 01 \|;b FF -;b 11 \|)>f;cat f;b FF X;tac f
```
**or** 
```
b(){ echo "obase=2;$1"|bc|tr '01' ' '$2;};(b 511 -;b 257 \|;b 511 -;b 273 \|)>f;cat f;b 511 X;tac f 
```
**Using bc in function : 99 Bytes**
```
b(){ echo "obase=2;$1"|bc|tr '01' ' '$2;};(b 511 -;b 257 \|;b 511 -;b 273 \|)>f;cat f;b 511 X;tac f 
```
[Answer]
# Powershell, 56 bytes
```
(('-'*9),'|       |'+'-'*9+'|   |   |'+'x'*9)[0..4+3..0]
```
Explanation: straightforward half-of-the-court
# Alternative, 68 bytes
```
('-----','|    '+'-'*5+'|   |'+'x'*5)[($r=0..4+3..0)]|%{-join$_[$r]}
```
Explanation: quarter-of-the-court uses the same indexes for both row and column display
]