Relevant Part for a Badminton Serve
Python 2, 285 284 bytes
R=str.replace
s,q=input()
A=' '*19
l='| '[s]+' |'+A[4:]+'|'+A
r=['T--+',' T'][s]+'-'*15+'T'+A
h=[r]+[l,R(r,*'T+')]*s+[l]*8+[l[:18]+'F'+'|'+A,r,l,l,'O'+'='*37+'O']
h+=[R(l[::-1],*'T+')for l in h[-2::-1]]
h[9+2*s]=R(h[9+2*s],*'F ')
for l in[l[::q%2*2-1]for l in h[::q/2*2-1]]:print l
Try it online!
Takes input as 0/1
(or False/True
) for game type (Double/Single
),
and 0-3
for serving block (0,1,2,3
= C,D,A,B
)
Charcoal, 81 bytes
NθF⮌Eθ⁺¹⁶׳ιF✂541⊖θURι±×³Iκ×=¹⁸O⟲O↙⁴J¹±³FF²F²«J×ι±⁺¹²×³θ⁺²×⁻¹⁵׳θκT»F№ABη‖↑F№ACη‖
Try it online! Link is to verbose version of code. Takes the first input as 1
or 2
for singles or doubles, second input as one of ABCD
as in the question. Explanation:
F⮌Eθ⁺¹⁶׳ιF✂541⊖θURι±×³Iκ
Loop over the relevant widths and the heights of the D
court and draw the rectangles.
×=¹⁸O⟲O↙⁴
Draw the net and apply rotational symmetry to add the A
court.
J¹±³F
Add the F
to the D
court.
F²F²«J×ι±⁺¹²×³θ⁺²×⁻¹⁵׳θκT»
Add the T
s to the relevant places in the A
court.
F№ABη‖↑F№ACη‖
Reflect the output as necessary to serve from the correct court.