Relevant Part for a Badminton Serve The Next CEO of Stack OverflowValid Badminton Score?Confused badminton playersGolfing ASCII-artConfused badminton playersASCII art reflectionASCII art for torrent UIIt was just an input-bugUnfold in all directionsHighest or Lowest Occurrences?Bottom part of the HourglassInterval NotationsTernary-if Converter

Compensation for working overtime on Saturdays

Is it correct to say moon starry nights?

Man transported from Alternate World into ours by a Neutrino Detector

Physiological effects of huge anime eyes

Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact

How to pronounce fünf in 45

Could a dragon use its wings to swim?

Is it possible to make a 9x9 table fit within the default margins?

How can a day be of 24 hours?

How can I prove that a state of equilibrium is unstable?

Shortening a title without changing its meaning

Gauss' Posthumous Publications?

Are British MPs missing the point, with these 'Indicative Votes'?

What difference does it make matching a word with/without a trailing whitespace?

Incomplete cube

Creating a script with console commands

Does Germany produce more waste than the US?

Which acid/base does a strong base/acid react when added to a buffer solution?

"Eavesdropping" vs "Listen in on"

What is the difference between 'contrib' and 'non-free' packages repositories?

Why does freezing point matter when picking cooler ice packs?

Does int main() need a declaration on C++?

How can I replace x-axis labels with pre-determined symbols?

Arrows in tikz Markov chain diagram overlap



Relevant Part for a Badminton Serve



The Next CEO of Stack OverflowValid Badminton Score?Confused badminton playersGolfing ASCII-artConfused badminton playersASCII art reflectionASCII art for torrent UIIt was just an input-bugUnfold in all directionsHighest or Lowest Occurrences?Bottom part of the HourglassInterval NotationsTernary-if Converter










7












$begingroup$


Introduction:



I saw there was only one other badminton related challenge right now. Since I play badminton myself (for the past 13 years now), I figured I'd add some badminton-related challenges. Here the second (first one can be found here):



Challenge:



Some rules about badminton serves:



  • A serve will always be done diagonally over the net.

  • You must always serve after the line that's parallel and nearest to the net.

  • The area in which you are allowed to serve differs depending on whether it's a single (1 vs 1) or double/mix (2 vs 2).

    • For singles (1 vs 1), the blue area in the picture below is where you are allowed to serve. So this is including the part at the back, but excluding the parts at the side.

    • For doubles/mix (2 vs 2), the green area in the picture below is where you are allowed to server. So this is excluding the part at the back, but including the parts at the side.


  • You may not stand on the lines when serving. But the shuttle will still be inside if they land on top of a line.

Here the layout of a badminton field:
enter image description here



Challenge rules:



Input:



You will be given two inputs:



  • Something to indicate whether we're playing a single or double/mix (i.e. a boolean)

  • Something to indicate which block you're serving from (i.e. [1,2,3,4] or ['A','B','C','D'] as used in the picture above).

Output:



Only the relevant lines for the current serve (including the net), including an F to indicate where you serve from, and multiple T to indicate where you will potentially serve to.



Although in reality you're allowed to serve from and to anywhere in the designated areas, we assume a person that will serve will always stands in the corner of the serve area closes to the middle of the net, which is where you'll place the F. And they will serve to any of the four corners of the area where they have to serve to, which is where you'll place the Ts.

As ASCII-art, the entire badminton field would be the following (the numbers are added so you don't have to count them yourself):



 2 15 15 2

+--+---------------+---------------+--+
| | | | | 1
+--+---------------+---------------+--+
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | 9
| | | | |
| | | | |
| | | | |
| | | | |
+--+---------------+---------------+--+
| | | | | 2
| | | | |
O=====================================O 37 times '='
| | | | |
| | | | | 2
+--+---------------+---------------+--+
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | 9
| | | | |
| | | | |
| | | | |
| | | | |
+--+---------------+---------------+--+
| | | | | 1
+--+---------------+---------------+--+


Examples:



Here two examples for outputting only the relevant parts of the serve:



Input: Single and serve block A

Output:



 T---------------T 
| |
+---------------+
| |
| |
| |
| |
| |
| |
| |
| |
| |
T---------------T
| |
| |
O=====================================O
| |
| |
+---------------+
| F|
| |
| |
| |
| |
| |
| |
| |
| |
+---------------+
| |
+---------------+


As you can see, the F is added in the corner within the block, but the T are replacing the + in the ASCI-art output.




Input: Double and serve block C

Output:



 

+--+---------------+
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | F|
+--+---------------+
| | |
| | |
O=====================================O
| | |
| | |
T---------------+--T
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
T---------------+--T



Challenge rules:



  • Leading and trailing newlines are optional (including the leading and trailing two empty lines when the input is single). Trailing spaces are optional as well. Leading spaces are mandatory however.

  • Any four reasonable distinct inputs to indicate which block we're serving from are allowed (for integers, stay within the [-999,999] range); as well as any two reasonable distinct inputs to indicate whether its a single or double/mix (please note this relevant forbidden loophole, though). Please state the I/O you've used in your answer!

  • You are allowed to use a lowercase f and t (or mixed case) instead of F and T.

  • You are allowed to return a list of lines or matrix of characters instead of returning or printing a single output-string.

General rules:



  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.









share|improve this question











$endgroup$











  • $begingroup$
    Ah, badminton. The one game I’ve always wanted to play but never got around to because forgot/couldn’t find players to play with
    $endgroup$
    – Quintec
    15 hours ago










  • $begingroup$
    @Quintec Feel free to come visit our club in The Netherlands for a free evening ;p
    $endgroup$
    – Kevin Cruijssen
    15 hours ago






  • 1




    $begingroup$
    Deal, if you pay for my plane ticket and hotel? :)
    $endgroup$
    – Quintec
    14 hours ago







  • 1




    $begingroup$
    @Quintec If you win, I'll pay the flight ticket back, haha xD
    $endgroup$
    – Kevin Cruijssen
    14 hours ago










  • $begingroup$
    I had no idea this was considered a sport in other countries still! Neato. Are there like, professional players too? Can you make millions doing badminton at the highest levels :P?
    $endgroup$
    – Magic Octopus Urn
    6 hours ago
















7












$begingroup$


Introduction:



I saw there was only one other badminton related challenge right now. Since I play badminton myself (for the past 13 years now), I figured I'd add some badminton-related challenges. Here the second (first one can be found here):



Challenge:



Some rules about badminton serves:



  • A serve will always be done diagonally over the net.

  • You must always serve after the line that's parallel and nearest to the net.

  • The area in which you are allowed to serve differs depending on whether it's a single (1 vs 1) or double/mix (2 vs 2).

    • For singles (1 vs 1), the blue area in the picture below is where you are allowed to serve. So this is including the part at the back, but excluding the parts at the side.

    • For doubles/mix (2 vs 2), the green area in the picture below is where you are allowed to server. So this is excluding the part at the back, but including the parts at the side.


  • You may not stand on the lines when serving. But the shuttle will still be inside if they land on top of a line.

Here the layout of a badminton field:
enter image description here



Challenge rules:



Input:



You will be given two inputs:



  • Something to indicate whether we're playing a single or double/mix (i.e. a boolean)

  • Something to indicate which block you're serving from (i.e. [1,2,3,4] or ['A','B','C','D'] as used in the picture above).

Output:



Only the relevant lines for the current serve (including the net), including an F to indicate where you serve from, and multiple T to indicate where you will potentially serve to.



Although in reality you're allowed to serve from and to anywhere in the designated areas, we assume a person that will serve will always stands in the corner of the serve area closes to the middle of the net, which is where you'll place the F. And they will serve to any of the four corners of the area where they have to serve to, which is where you'll place the Ts.

As ASCII-art, the entire badminton field would be the following (the numbers are added so you don't have to count them yourself):



 2 15 15 2

+--+---------------+---------------+--+
| | | | | 1
+--+---------------+---------------+--+
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | 9
| | | | |
| | | | |
| | | | |
| | | | |
+--+---------------+---------------+--+
| | | | | 2
| | | | |
O=====================================O 37 times '='
| | | | |
| | | | | 2
+--+---------------+---------------+--+
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | 9
| | | | |
| | | | |
| | | | |
| | | | |
+--+---------------+---------------+--+
| | | | | 1
+--+---------------+---------------+--+


Examples:



Here two examples for outputting only the relevant parts of the serve:



Input: Single and serve block A

Output:



 T---------------T 
| |
+---------------+
| |
| |
| |
| |
| |
| |
| |
| |
| |
T---------------T
| |
| |
O=====================================O
| |
| |
+---------------+
| F|
| |
| |
| |
| |
| |
| |
| |
| |
+---------------+
| |
+---------------+


As you can see, the F is added in the corner within the block, but the T are replacing the + in the ASCI-art output.




Input: Double and serve block C

Output:



 

+--+---------------+
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | F|
+--+---------------+
| | |
| | |
O=====================================O
| | |
| | |
T---------------+--T
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
T---------------+--T



Challenge rules:



  • Leading and trailing newlines are optional (including the leading and trailing two empty lines when the input is single). Trailing spaces are optional as well. Leading spaces are mandatory however.

  • Any four reasonable distinct inputs to indicate which block we're serving from are allowed (for integers, stay within the [-999,999] range); as well as any two reasonable distinct inputs to indicate whether its a single or double/mix (please note this relevant forbidden loophole, though). Please state the I/O you've used in your answer!

  • You are allowed to use a lowercase f and t (or mixed case) instead of F and T.

  • You are allowed to return a list of lines or matrix of characters instead of returning or printing a single output-string.

General rules:



  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.









share|improve this question











$endgroup$











  • $begingroup$
    Ah, badminton. The one game I’ve always wanted to play but never got around to because forgot/couldn’t find players to play with
    $endgroup$
    – Quintec
    15 hours ago










  • $begingroup$
    @Quintec Feel free to come visit our club in The Netherlands for a free evening ;p
    $endgroup$
    – Kevin Cruijssen
    15 hours ago






  • 1




    $begingroup$
    Deal, if you pay for my plane ticket and hotel? :)
    $endgroup$
    – Quintec
    14 hours ago







  • 1




    $begingroup$
    @Quintec If you win, I'll pay the flight ticket back, haha xD
    $endgroup$
    – Kevin Cruijssen
    14 hours ago










  • $begingroup$
    I had no idea this was considered a sport in other countries still! Neato. Are there like, professional players too? Can you make millions doing badminton at the highest levels :P?
    $endgroup$
    – Magic Octopus Urn
    6 hours ago














7












7








7


1



$begingroup$


Introduction:



I saw there was only one other badminton related challenge right now. Since I play badminton myself (for the past 13 years now), I figured I'd add some badminton-related challenges. Here the second (first one can be found here):



Challenge:



Some rules about badminton serves:



  • A serve will always be done diagonally over the net.

  • You must always serve after the line that's parallel and nearest to the net.

  • The area in which you are allowed to serve differs depending on whether it's a single (1 vs 1) or double/mix (2 vs 2).

    • For singles (1 vs 1), the blue area in the picture below is where you are allowed to serve. So this is including the part at the back, but excluding the parts at the side.

    • For doubles/mix (2 vs 2), the green area in the picture below is where you are allowed to server. So this is excluding the part at the back, but including the parts at the side.


  • You may not stand on the lines when serving. But the shuttle will still be inside if they land on top of a line.

Here the layout of a badminton field:
enter image description here



Challenge rules:



Input:



You will be given two inputs:



  • Something to indicate whether we're playing a single or double/mix (i.e. a boolean)

  • Something to indicate which block you're serving from (i.e. [1,2,3,4] or ['A','B','C','D'] as used in the picture above).

Output:



Only the relevant lines for the current serve (including the net), including an F to indicate where you serve from, and multiple T to indicate where you will potentially serve to.



Although in reality you're allowed to serve from and to anywhere in the designated areas, we assume a person that will serve will always stands in the corner of the serve area closes to the middle of the net, which is where you'll place the F. And they will serve to any of the four corners of the area where they have to serve to, which is where you'll place the Ts.

As ASCII-art, the entire badminton field would be the following (the numbers are added so you don't have to count them yourself):



 2 15 15 2

+--+---------------+---------------+--+
| | | | | 1
+--+---------------+---------------+--+
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | 9
| | | | |
| | | | |
| | | | |
| | | | |
+--+---------------+---------------+--+
| | | | | 2
| | | | |
O=====================================O 37 times '='
| | | | |
| | | | | 2
+--+---------------+---------------+--+
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | 9
| | | | |
| | | | |
| | | | |
| | | | |
+--+---------------+---------------+--+
| | | | | 1
+--+---------------+---------------+--+


Examples:



Here two examples for outputting only the relevant parts of the serve:



Input: Single and serve block A

Output:



 T---------------T 
| |
+---------------+
| |
| |
| |
| |
| |
| |
| |
| |
| |
T---------------T
| |
| |
O=====================================O
| |
| |
+---------------+
| F|
| |
| |
| |
| |
| |
| |
| |
| |
+---------------+
| |
+---------------+


As you can see, the F is added in the corner within the block, but the T are replacing the + in the ASCI-art output.




Input: Double and serve block C

Output:



 

+--+---------------+
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | F|
+--+---------------+
| | |
| | |
O=====================================O
| | |
| | |
T---------------+--T
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
T---------------+--T



Challenge rules:



  • Leading and trailing newlines are optional (including the leading and trailing two empty lines when the input is single). Trailing spaces are optional as well. Leading spaces are mandatory however.

  • Any four reasonable distinct inputs to indicate which block we're serving from are allowed (for integers, stay within the [-999,999] range); as well as any two reasonable distinct inputs to indicate whether its a single or double/mix (please note this relevant forbidden loophole, though). Please state the I/O you've used in your answer!

  • You are allowed to use a lowercase f and t (or mixed case) instead of F and T.

  • You are allowed to return a list of lines or matrix of characters instead of returning or printing a single output-string.

General rules:



  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.









share|improve this question











$endgroup$




Introduction:



I saw there was only one other badminton related challenge right now. Since I play badminton myself (for the past 13 years now), I figured I'd add some badminton-related challenges. Here the second (first one can be found here):



Challenge:



Some rules about badminton serves:



  • A serve will always be done diagonally over the net.

  • You must always serve after the line that's parallel and nearest to the net.

  • The area in which you are allowed to serve differs depending on whether it's a single (1 vs 1) or double/mix (2 vs 2).

    • For singles (1 vs 1), the blue area in the picture below is where you are allowed to serve. So this is including the part at the back, but excluding the parts at the side.

    • For doubles/mix (2 vs 2), the green area in the picture below is where you are allowed to server. So this is excluding the part at the back, but including the parts at the side.


  • You may not stand on the lines when serving. But the shuttle will still be inside if they land on top of a line.

Here the layout of a badminton field:
enter image description here



Challenge rules:



Input:



You will be given two inputs:



  • Something to indicate whether we're playing a single or double/mix (i.e. a boolean)

  • Something to indicate which block you're serving from (i.e. [1,2,3,4] or ['A','B','C','D'] as used in the picture above).

Output:



Only the relevant lines for the current serve (including the net), including an F to indicate where you serve from, and multiple T to indicate where you will potentially serve to.



Although in reality you're allowed to serve from and to anywhere in the designated areas, we assume a person that will serve will always stands in the corner of the serve area closes to the middle of the net, which is where you'll place the F. And they will serve to any of the four corners of the area where they have to serve to, which is where you'll place the Ts.

As ASCII-art, the entire badminton field would be the following (the numbers are added so you don't have to count them yourself):



 2 15 15 2

+--+---------------+---------------+--+
| | | | | 1
+--+---------------+---------------+--+
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | 9
| | | | |
| | | | |
| | | | |
| | | | |
+--+---------------+---------------+--+
| | | | | 2
| | | | |
O=====================================O 37 times '='
| | | | |
| | | | | 2
+--+---------------+---------------+--+
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | 9
| | | | |
| | | | |
| | | | |
| | | | |
+--+---------------+---------------+--+
| | | | | 1
+--+---------------+---------------+--+


Examples:



Here two examples for outputting only the relevant parts of the serve:



Input: Single and serve block A

Output:



 T---------------T 
| |
+---------------+
| |
| |
| |
| |
| |
| |
| |
| |
| |
T---------------T
| |
| |
O=====================================O
| |
| |
+---------------+
| F|
| |
| |
| |
| |
| |
| |
| |
| |
+---------------+
| |
+---------------+


As you can see, the F is added in the corner within the block, but the T are replacing the + in the ASCI-art output.




Input: Double and serve block C

Output:



 

+--+---------------+
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | F|
+--+---------------+
| | |
| | |
O=====================================O
| | |
| | |
T---------------+--T
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
T---------------+--T



Challenge rules:



  • Leading and trailing newlines are optional (including the leading and trailing two empty lines when the input is single). Trailing spaces are optional as well. Leading spaces are mandatory however.

  • Any four reasonable distinct inputs to indicate which block we're serving from are allowed (for integers, stay within the [-999,999] range); as well as any two reasonable distinct inputs to indicate whether its a single or double/mix (please note this relevant forbidden loophole, though). Please state the I/O you've used in your answer!

  • You are allowed to use a lowercase f and t (or mixed case) instead of F and T.

  • You are allowed to return a list of lines or matrix of characters instead of returning or printing a single output-string.

General rules:



  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.






code-golf string ascii-art






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 19 hours ago







Kevin Cruijssen

















asked 19 hours ago









Kevin CruijssenKevin Cruijssen

42k569217




42k569217











  • $begingroup$
    Ah, badminton. The one game I’ve always wanted to play but never got around to because forgot/couldn’t find players to play with
    $endgroup$
    – Quintec
    15 hours ago










  • $begingroup$
    @Quintec Feel free to come visit our club in The Netherlands for a free evening ;p
    $endgroup$
    – Kevin Cruijssen
    15 hours ago






  • 1




    $begingroup$
    Deal, if you pay for my plane ticket and hotel? :)
    $endgroup$
    – Quintec
    14 hours ago







  • 1




    $begingroup$
    @Quintec If you win, I'll pay the flight ticket back, haha xD
    $endgroup$
    – Kevin Cruijssen
    14 hours ago










  • $begingroup$
    I had no idea this was considered a sport in other countries still! Neato. Are there like, professional players too? Can you make millions doing badminton at the highest levels :P?
    $endgroup$
    – Magic Octopus Urn
    6 hours ago

















  • $begingroup$
    Ah, badminton. The one game I’ve always wanted to play but never got around to because forgot/couldn’t find players to play with
    $endgroup$
    – Quintec
    15 hours ago










  • $begingroup$
    @Quintec Feel free to come visit our club in The Netherlands for a free evening ;p
    $endgroup$
    – Kevin Cruijssen
    15 hours ago






  • 1




    $begingroup$
    Deal, if you pay for my plane ticket and hotel? :)
    $endgroup$
    – Quintec
    14 hours ago







  • 1




    $begingroup$
    @Quintec If you win, I'll pay the flight ticket back, haha xD
    $endgroup$
    – Kevin Cruijssen
    14 hours ago










  • $begingroup$
    I had no idea this was considered a sport in other countries still! Neato. Are there like, professional players too? Can you make millions doing badminton at the highest levels :P?
    $endgroup$
    – Magic Octopus Urn
    6 hours ago
















$begingroup$
Ah, badminton. The one game I’ve always wanted to play but never got around to because forgot/couldn’t find players to play with
$endgroup$
– Quintec
15 hours ago




$begingroup$
Ah, badminton. The one game I’ve always wanted to play but never got around to because forgot/couldn’t find players to play with
$endgroup$
– Quintec
15 hours ago












$begingroup$
@Quintec Feel free to come visit our club in The Netherlands for a free evening ;p
$endgroup$
– Kevin Cruijssen
15 hours ago




$begingroup$
@Quintec Feel free to come visit our club in The Netherlands for a free evening ;p
$endgroup$
– Kevin Cruijssen
15 hours ago




1




1




$begingroup$
Deal, if you pay for my plane ticket and hotel? :)
$endgroup$
– Quintec
14 hours ago





$begingroup$
Deal, if you pay for my plane ticket and hotel? :)
$endgroup$
– Quintec
14 hours ago





1




1




$begingroup$
@Quintec If you win, I'll pay the flight ticket back, haha xD
$endgroup$
– Kevin Cruijssen
14 hours ago




$begingroup$
@Quintec If you win, I'll pay the flight ticket back, haha xD
$endgroup$
– Kevin Cruijssen
14 hours ago












$begingroup$
I had no idea this was considered a sport in other countries still! Neato. Are there like, professional players too? Can you make millions doing badminton at the highest levels :P?
$endgroup$
– Magic Octopus Urn
6 hours ago





$begingroup$
I had no idea this was considered a sport in other countries still! Neato. Are there like, professional players too? Can you make millions doing badminton at the highest levels :P?
$endgroup$
– Magic Octopus Urn
6 hours ago











4 Answers
4






active

oldest

votes


















3












$begingroup$


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)






share|improve this answer











$endgroup$












  • $begingroup$
    That was fast! Nice answer.
    $endgroup$
    – Kevin Cruijssen
    19 hours ago






  • 1




    $begingroup$
    @Yeah, I kinda tried it from sandbox last week :P
    $endgroup$
    – TFeld
    19 hours ago


















1












$begingroup$

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.






share|improve this answer











$endgroup$












  • $begingroup$
    *Opens TIO and starts verifying the output* Looks good; all eight outputs are correct, as expected. *Looks at actual code* Huh.. wth is going on¿.. :S Looking forward to that explanation later on, @Arnauld. An unexpected amount of arithmetic, ternary, and bitwise calculations for an ASCII-art challenge. xD
    $endgroup$
    – Kevin Cruijssen
    10 hours ago



















0












$begingroup$


Charcoal, 74 bytes



F⮌EIθ⁺¹⁶׳ιF541URι±×³Iκ×=¹⁸O⟲O↙⁴J¹±³FF²F²«J×ι±⁺¹²×³Iθ⁺²×¹²κ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⮌EIθ⁺¹⁶׳ιF541URι±×³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×ι±⁺¹²×³Iθ⁺²×¹²κT»


Add the Ts to the relevant places in the A court.



F№ABη‖↑F№ACη‖


Reflect the output as necessary to serve from the correct court.






share|improve this answer









$endgroup$




















    0












    $begingroup$


    Jelly, 108 100 bytes



    “¢¥Þ‘Ṭ+þ³ḤN+“¢¤€‘¤ṬḤ;Ø0¤×3R¤¦€³+0x39¤µ‘03³?‘;20¤¦€1,-2¦;565DWx“¢%¢‘¤;UṚ$ị“|-+TO= ”“F”21¦€³Ḥ_⁵¤¦UṚƭ⁴¡


    Try it online!



    I’m sure this can be better golfed.



    Dyadic link with left argument 0 or 1 for singles/doubles and right argument 0,1,2,3 for different serve quadrants. Returns a list of strings






    share|improve this answer











    $endgroup$













      Your Answer





      StackExchange.ifUsing("editor", function ()
      return StackExchange.using("mathjaxEditing", function ()
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
      );
      );
      , "mathjax-editing");

      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "200"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f182496%2frelevant-part-for-a-badminton-serve%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3












      $begingroup$


      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)






      share|improve this answer











      $endgroup$












      • $begingroup$
        That was fast! Nice answer.
        $endgroup$
        – Kevin Cruijssen
        19 hours ago






      • 1




        $begingroup$
        @Yeah, I kinda tried it from sandbox last week :P
        $endgroup$
        – TFeld
        19 hours ago















      3












      $begingroup$


      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)






      share|improve this answer











      $endgroup$












      • $begingroup$
        That was fast! Nice answer.
        $endgroup$
        – Kevin Cruijssen
        19 hours ago






      • 1




        $begingroup$
        @Yeah, I kinda tried it from sandbox last week :P
        $endgroup$
        – TFeld
        19 hours ago













      3












      3








      3





      $begingroup$


      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)






      share|improve this answer











      $endgroup$




      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)







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited 11 hours ago

























      answered 19 hours ago









      TFeldTFeld

      16.3k21451




      16.3k21451











      • $begingroup$
        That was fast! Nice answer.
        $endgroup$
        – Kevin Cruijssen
        19 hours ago






      • 1




        $begingroup$
        @Yeah, I kinda tried it from sandbox last week :P
        $endgroup$
        – TFeld
        19 hours ago
















      • $begingroup$
        That was fast! Nice answer.
        $endgroup$
        – Kevin Cruijssen
        19 hours ago






      • 1




        $begingroup$
        @Yeah, I kinda tried it from sandbox last week :P
        $endgroup$
        – TFeld
        19 hours ago















      $begingroup$
      That was fast! Nice answer.
      $endgroup$
      – Kevin Cruijssen
      19 hours ago




      $begingroup$
      That was fast! Nice answer.
      $endgroup$
      – Kevin Cruijssen
      19 hours ago




      1




      1




      $begingroup$
      @Yeah, I kinda tried it from sandbox last week :P
      $endgroup$
      – TFeld
      19 hours ago




      $begingroup$
      @Yeah, I kinda tried it from sandbox last week :P
      $endgroup$
      – TFeld
      19 hours ago











      1












      $begingroup$

      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.






      share|improve this answer











      $endgroup$












      • $begingroup$
        *Opens TIO and starts verifying the output* Looks good; all eight outputs are correct, as expected. *Looks at actual code* Huh.. wth is going on¿.. :S Looking forward to that explanation later on, @Arnauld. An unexpected amount of arithmetic, ternary, and bitwise calculations for an ASCII-art challenge. xD
        $endgroup$
        – Kevin Cruijssen
        10 hours ago
















      1












      $begingroup$

      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.






      share|improve this answer











      $endgroup$












      • $begingroup$
        *Opens TIO and starts verifying the output* Looks good; all eight outputs are correct, as expected. *Looks at actual code* Huh.. wth is going on¿.. :S Looking forward to that explanation later on, @Arnauld. An unexpected amount of arithmetic, ternary, and bitwise calculations for an ASCII-art challenge. xD
        $endgroup$
        – Kevin Cruijssen
        10 hours ago














      1












      1








      1





      $begingroup$

      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.






      share|improve this answer











      $endgroup$



      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.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited 4 hours ago

























      answered 10 hours ago









      ArnauldArnauld

      80.1k797331




      80.1k797331











      • $begingroup$
        *Opens TIO and starts verifying the output* Looks good; all eight outputs are correct, as expected. *Looks at actual code* Huh.. wth is going on¿.. :S Looking forward to that explanation later on, @Arnauld. An unexpected amount of arithmetic, ternary, and bitwise calculations for an ASCII-art challenge. xD
        $endgroup$
        – Kevin Cruijssen
        10 hours ago

















      • $begingroup$
        *Opens TIO and starts verifying the output* Looks good; all eight outputs are correct, as expected. *Looks at actual code* Huh.. wth is going on¿.. :S Looking forward to that explanation later on, @Arnauld. An unexpected amount of arithmetic, ternary, and bitwise calculations for an ASCII-art challenge. xD
        $endgroup$
        – Kevin Cruijssen
        10 hours ago
















      $begingroup$
      *Opens TIO and starts verifying the output* Looks good; all eight outputs are correct, as expected. *Looks at actual code* Huh.. wth is going on¿.. :S Looking forward to that explanation later on, @Arnauld. An unexpected amount of arithmetic, ternary, and bitwise calculations for an ASCII-art challenge. xD
      $endgroup$
      – Kevin Cruijssen
      10 hours ago





      $begingroup$
      *Opens TIO and starts verifying the output* Looks good; all eight outputs are correct, as expected. *Looks at actual code* Huh.. wth is going on¿.. :S Looking forward to that explanation later on, @Arnauld. An unexpected amount of arithmetic, ternary, and bitwise calculations for an ASCII-art challenge. xD
      $endgroup$
      – Kevin Cruijssen
      10 hours ago












      0












      $begingroup$


      Charcoal, 74 bytes



      F⮌EIθ⁺¹⁶׳ιF541URι±×³Iκ×=¹⁸O⟲O↙⁴J¹±³FF²F²«J×ι±⁺¹²×³Iθ⁺²×¹²κ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⮌EIθ⁺¹⁶׳ιF541URι±×³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×ι±⁺¹²×³Iθ⁺²×¹²κT»


      Add the Ts to the relevant places in the A court.



      F№ABη‖↑F№ACη‖


      Reflect the output as necessary to serve from the correct court.






      share|improve this answer









      $endgroup$

















        0












        $begingroup$


        Charcoal, 74 bytes



        F⮌EIθ⁺¹⁶׳ιF541URι±×³Iκ×=¹⁸O⟲O↙⁴J¹±³FF²F²«J×ι±⁺¹²×³Iθ⁺²×¹²κ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⮌EIθ⁺¹⁶׳ιF541URι±×³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×ι±⁺¹²×³Iθ⁺²×¹²κT»


        Add the Ts to the relevant places in the A court.



        F№ABη‖↑F№ACη‖


        Reflect the output as necessary to serve from the correct court.






        share|improve this answer









        $endgroup$















          0












          0








          0





          $begingroup$


          Charcoal, 74 bytes



          F⮌EIθ⁺¹⁶׳ιF541URι±×³Iκ×=¹⁸O⟲O↙⁴J¹±³FF²F²«J×ι±⁺¹²×³Iθ⁺²×¹²κ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⮌EIθ⁺¹⁶׳ιF541URι±×³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×ι±⁺¹²×³Iθ⁺²×¹²κT»


          Add the Ts to the relevant places in the A court.



          F№ABη‖↑F№ACη‖


          Reflect the output as necessary to serve from the correct court.






          share|improve this answer









          $endgroup$




          Charcoal, 74 bytes



          F⮌EIθ⁺¹⁶׳ιF541URι±×³Iκ×=¹⁸O⟲O↙⁴J¹±³FF²F²«J×ι±⁺¹²×³Iθ⁺²×¹²κ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⮌EIθ⁺¹⁶׳ιF541URι±×³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×ι±⁺¹²×³Iθ⁺²×¹²κT»


          Add the Ts to the relevant places in the A court.



          F№ABη‖↑F№ACη‖


          Reflect the output as necessary to serve from the correct court.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 8 hours ago









          NeilNeil

          82.2k745178




          82.2k745178





















              0












              $begingroup$


              Jelly, 108 100 bytes



              “¢¥Þ‘Ṭ+þ³ḤN+“¢¤€‘¤ṬḤ;Ø0¤×3R¤¦€³+0x39¤µ‘03³?‘;20¤¦€1,-2¦;565DWx“¢%¢‘¤;UṚ$ị“|-+TO= ”“F”21¦€³Ḥ_⁵¤¦UṚƭ⁴¡


              Try it online!



              I’m sure this can be better golfed.



              Dyadic link with left argument 0 or 1 for singles/doubles and right argument 0,1,2,3 for different serve quadrants. Returns a list of strings






              share|improve this answer











              $endgroup$

















                0












                $begingroup$


                Jelly, 108 100 bytes



                “¢¥Þ‘Ṭ+þ³ḤN+“¢¤€‘¤ṬḤ;Ø0¤×3R¤¦€³+0x39¤µ‘03³?‘;20¤¦€1,-2¦;565DWx“¢%¢‘¤;UṚ$ị“|-+TO= ”“F”21¦€³Ḥ_⁵¤¦UṚƭ⁴¡


                Try it online!



                I’m sure this can be better golfed.



                Dyadic link with left argument 0 or 1 for singles/doubles and right argument 0,1,2,3 for different serve quadrants. Returns a list of strings






                share|improve this answer











                $endgroup$















                  0












                  0








                  0





                  $begingroup$


                  Jelly, 108 100 bytes



                  “¢¥Þ‘Ṭ+þ³ḤN+“¢¤€‘¤ṬḤ;Ø0¤×3R¤¦€³+0x39¤µ‘03³?‘;20¤¦€1,-2¦;565DWx“¢%¢‘¤;UṚ$ị“|-+TO= ”“F”21¦€³Ḥ_⁵¤¦UṚƭ⁴¡


                  Try it online!



                  I’m sure this can be better golfed.



                  Dyadic link with left argument 0 or 1 for singles/doubles and right argument 0,1,2,3 for different serve quadrants. Returns a list of strings






                  share|improve this answer











                  $endgroup$




                  Jelly, 108 100 bytes



                  “¢¥Þ‘Ṭ+þ³ḤN+“¢¤€‘¤ṬḤ;Ø0¤×3R¤¦€³+0x39¤µ‘03³?‘;20¤¦€1,-2¦;565DWx“¢%¢‘¤;UṚ$ị“|-+TO= ”“F”21¦€³Ḥ_⁵¤¦UṚƭ⁴¡


                  Try it online!



                  I’m sure this can be better golfed.



                  Dyadic link with left argument 0 or 1 for singles/doubles and right argument 0,1,2,3 for different serve quadrants. Returns a list of strings







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 4 hours ago

























                  answered 5 hours ago









                  Nick KennedyNick Kennedy

                  1,20649




                  1,20649



























                      draft saved

                      draft discarded
















































                      If this is an answer to a challenge…



                      • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                      • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                        Explanations of your answer make it more interesting to read and are very much encouraged.


                      • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                      More generally…



                      • …Please make sure to answer the question and provide sufficient detail.


                      • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f182496%2frelevant-part-for-a-badminton-serve%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                      Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                      Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form