Skip to main content
5 of 12
added 2 characters in body
Arnauld
  • 197.8k
  • 20
  • 180
  • 650

#JavaScript (ES7),  216  212 bytes

Takes input as (block)(double), where block is either \$1\$ (top right), \$2\$ (bottom right), \$3\$ (bottom left) or \$4\$ (top left) and double is a Boolean value.

b=>d=>(g=x=>y<31?` |-+=OTF
`[X=(x-19)**2,Y=(y-15)**2,i=x*24%35<3|16>>Y%62%6&2,q=y>15^b/2&1,x<39?Y?x>19^y>15^b%2&&X||(d?Y>169:X>256)?0:i-3?X-1|Y-16|q?i:7:q*(d?X-256:Y-169)?6:3:x%38?4:5:8]+g(x<39?x+1:!++y):'')(y=0)

Try it online!

Formatted version

###How?

We iterate from \$y=0\$ to \$y=30\$ and from from \$x=0\$ to \$x=39\$ for each value of \$y\$.

We define \$X=(x-19)^2\$ and \$Y=(y-15)^2\$ in order to test absolution positions within each quarter of the field.

The expression x * 24 % 35 < 3 yields true if \$x\$ belongs to \$\{0, 3, 19, 35, 38\}\$ (the positions of the vertical lines) or false otherwise.

Try it online!

The expression 16 >> Y % 62 % 6 & 2 yields \$2\$ if \$y\$ belongs to \$\{0, 2, 12, 18, 28, 30\}\$ (the positions of the horizontal lines, excluding the net) or \$0\$ otherwise.

Try it online!

The variable \$i\$ is defined as the result of a bitwise OR between the two above values, and is therefore interpreted as:

  • 0: space
  • 1: |
  • 2: -
  • 3: +

The expressions q = y > 15 ^ b / 2 & 1 and x > 19 ^ y > 15 ^ b % 2 && X are used to determine what do draw in each quarter according to the block \$b\$.

The expression d ? Y > 169 : X > 256 is used to crop the field according to the game type \$d\$ (single or double). The similar expression d ? X - 256 : Y - 169 is used to draw the T's at the appropriate positions.

Arnauld
  • 197.8k
  • 20
  • 180
  • 650