Skip to main content
-9 bytes thanks to mazzy
Source Link
AdmBorkBork
  • 43.5k
  • 5
  • 103
  • 284

PowerShell v2+, 175 169 163163 154 bytes

($x=(-join(65..67+66..86|%{$_;32+$_}|%{[char]$_})-split'(.{6})'-ne'')+'   WwXx'+'       Yy'+(' '*9+'Z')|% *ht 10|%{$_+-join$_[9..0]})
' '*9+'zz'
$x[10..0]
($x=(-join(65..67+66..86|%{[char[]]($_,(32+$_))})-split"(......)"-ne''|%{"$_    "})+'   WwXx   '+'       Yy '+(' '*9+'Z')|%{$_+-join$_[9..0]})
' '*9+'zz'
$x[10..0]

Try it online!

These strings in an array get individually concatenated with spaces (that's the |%{"$_ "} loop in the middle), then array-concatenation to add on the WwXx, Yy, and Z elements, then a PadRight 10 to make them all the appropriate width. At this point we have an array of strings like the following (one element per line).

AaBbCc    
BbCcDd    
EeFfGg    
HhIiJj    
KkLlMm    
NnOoPp    
QqRrSs    
TtUuVv    
   WwXx   
       Yy 
         Z
AaBbCc    
BbCcDd    
EeFfGg    
HhIiJj    
KkLlMm    
NnOoPp    
QqRrSs    
TtUuVv    
   WwXx   
       Yy 
         Z

That whole array is piped to another loop to construct the mirrored strings with -join and array-reversing [9..0].

AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       
         ZZ         
AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       
         ZZ         

The next line places the zz string on the pipeline, then the $x array in reverse order. All of those are left on the pipeline and output is implicit.

PS C:\Tools\Scripts\golfing> .\alphabet-chromosome.ps1
AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       
         ZZ
         zz
         ZZ
       Yy  yY       
   WwXx      xXwW   
TtUuVv        vVuUtT
QqRrSs        sSrRqQ
NnOoPp        pPoOnN
KkLlMm        mMlLkK
HhIiJj        jJiIhH
EeFfGg        gGfFeE
BbCcDd        dDcCbB
AaBbCc        cCbBaA
PS C:\Tools\Scripts\golfing> .\alphabet-chromosome.ps1
AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       
         ZZ
         zz
         ZZ
       Yy  yY       
   WwXx      xXwW   
TtUuVv        vVuUtT
QqRrSs        sSrRqQ
NnOoPp        pPoOnN
KkLlMm        mMlLkK
HhIiJj        jJiIhH
EeFfGg        gGfFeE
BbCcDd        dDcCbB
AaBbCc        cCbBaA

-9 bytes thanks to mazzy.

PowerShell v2+, 175 169 163 bytes

($x=(-join(65..67+66..86|%{[char[]]($_,(32+$_))})-split"(......)"-ne''|%{"$_    "})+'   WwXx   '+'       Yy '+(' '*9+'Z')|%{$_+-join$_[9..0]})
' '*9+'zz'
$x[10..0]

These strings in an array get individually concatenated with spaces (that's the |%{"$_ "} loop in the middle), then array-concatenation to add on the WwXx, Yy, and Z elements. At this point we have an array of strings like the following (one element per line).

AaBbCc    
BbCcDd    
EeFfGg    
HhIiJj    
KkLlMm    
NnOoPp    
QqRrSs    
TtUuVv    
   WwXx   
       Yy 
         Z

That whole array is piped to another loop to construct the mirrored strings with -join and array-reversing.

AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       
         ZZ         

The next places the zz string on the pipeline, then the $x array in reverse order. All of those are left on the pipeline and output is implicit.

PS C:\Tools\Scripts\golfing> .\alphabet-chromosome.ps1
AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       
         ZZ
         zz
         ZZ
       Yy  yY       
   WwXx      xXwW   
TtUuVv        vVuUtT
QqRrSs        sSrRqQ
NnOoPp        pPoOnN
KkLlMm        mMlLkK
HhIiJj        jJiIhH
EeFfGg        gGfFeE
BbCcDd        dDcCbB
AaBbCc        cCbBaA

PowerShell v2+, 175 169 163 154 bytes

($x=(-join(65..67+66..86|%{$_;32+$_}|%{[char]$_})-split'(.{6})'-ne'')+'   WwXx'+'       Yy'+(' '*9+'Z')|% *ht 10|%{$_+-join$_[9..0]})
' '*9+'zz'
$x[10..0]

Try it online!

These strings in an array get array-concatenation to add on the WwXx, Yy, and Z elements, then a PadRight 10 to make them all the appropriate width. At this point we have an array of strings like the following (one element per line).

AaBbCc    
BbCcDd    
EeFfGg    
HhIiJj    
KkLlMm    
NnOoPp    
QqRrSs    
TtUuVv    
   WwXx   
       Yy 
         Z

That whole array is piped to another loop to construct the mirrored strings with -join and array-reversing [9..0].

AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       
         ZZ         

The next line places the zz string on the pipeline, then the $x array in reverse order. All of those are left on the pipeline and output is implicit.

PS C:\Tools\Scripts\golfing> .\alphabet-chromosome.ps1
AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       
         ZZ
         zz
         ZZ
       Yy  yY       
   WwXx      xXwW   
TtUuVv        vVuUtT
QqRrSs        sSrRqQ
NnOoPp        pPoOnN
KkLlMm        mMlLkK
HhIiJj        jJiIhH
EeFfGg        gGfFeE
BbCcDd        dDcCbB
AaBbCc        cCbBaA

-9 bytes thanks to mazzy.

Saved 6 bytes by using code points instead of literal strings
Source Link
AdmBorkBork
  • 43.5k
  • 5
  • 103
  • 284

PowerShell v2+, 175 169169 163 bytes

($x=('AaBbCc','BbCcDd','EeFfGg','HhIiJj','KkLlMm','NnOoPp','QqRrSs'-join(65..67+66..86|%{[char[]]($_,'TtUuVv'|%(32+$_))})-split"(......)"-ne''|%{"$_    "})+'   WwXx   '+'       Yy '+(' '*9+'Z')|%{$_+-join$_[9..0]})
' '*9+'zz'
$x[10..0]

The first line constructs the branches. We loop over two ranges corresponding to the ASCII values for the capital letters, with just literaleach iteration output a char array of that letter and that letter +32 (which is the lowercase ASCII point). That's -joined together into one long string, then -split on every six elements (encapsulated in parens so they're preserved), followed by a -ne'' to pull out the empty elements as a result of the split, thus forming an array of strings.

These strings in an array get individually concatenated with spaces (that's the first |%{..."$_ "} loop in the middle), then array-concatenation to add on the WwXx, Yy, and Z elements. At this point we have an array of strings like the following (one element per line).

That whole array is piped to another loop to construct the mirrored strings with -join and array-reversing.

PowerShell v2+, 175 169 bytes

($x=('AaBbCc','BbCcDd','EeFfGg','HhIiJj','KkLlMm','NnOoPp','QqRrSs','TtUuVv'|%{"$_    "})+'   WwXx   '+'       Yy '+(' '*9+'Z')|%{$_+-join$_[9..0]})
' '*9+'zz'
$x[10..0]

The first line constructs the branches, with just literal strings in an array concatenated with spaces (that's the first |%{...} loop in the middle), then array-concatenation to add on the WwXx, Yy, and Z elements. At this point we have an array of strings like the following (one element per line).

That whole array is piped to another loop to construct the mirrored strings with -join.

PowerShell v2+, 175 169 163 bytes

($x=(-join(65..67+66..86|%{[char[]]($_,(32+$_))})-split"(......)"-ne''|%{"$_    "})+'   WwXx   '+'       Yy '+(' '*9+'Z')|%{$_+-join$_[9..0]})
' '*9+'zz'
$x[10..0]

The first line constructs the branches. We loop over two ranges corresponding to the ASCII values for the capital letters, each iteration output a char array of that letter and that letter +32 (which is the lowercase ASCII point). That's -joined together into one long string, then -split on every six elements (encapsulated in parens so they're preserved), followed by a -ne'' to pull out the empty elements as a result of the split, thus forming an array of strings.

These strings in an array get individually concatenated with spaces (that's the |%{"$_ "} loop in the middle), then array-concatenation to add on the WwXx, Yy, and Z elements. At this point we have an array of strings like the following (one element per line).

That whole array is piped to another loop to construct the mirrored strings with -join and array-reversing.

Move Z into the first string to save a couple bytes
Source Link
AdmBorkBork
  • 43.5k
  • 5
  • 103
  • 284

PowerShell v2+, 175175 169 bytes

($x=('AaBbCc','BbCcDd','EeFfGg','HhIiJj','KkLlMm','NnOoPp','QqRrSs','TtUuVv'|%{"$_    "})+'   WwXx   '+'       Yy '|%'+(' '*9+'Z')|%{$_+-join$_[9..0]})
($z=' '*9+'ZZ')
' '*9+'zz'
$z
$x[9$x[10..0]

The first line constructs the branches, with just literal strings in an array concatenated with spaces (that's the first |%{...} loop in the middle), then array-concatenation to add on the WwXx and, Yy, and Z elements. At this point we have an array of strings like the following (one element per line).

AaBbCc    
BbCcDd    
EeFfGg    
HhIiJj    
KkLlMm    
NnOoPp    
QqRrSs    
TtUuVv    
   WwXx   
       Yy 
         Z
AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       
         ZZ         

The next line constructs the ZZ string, saves it into $z, and also encloses in parens to place a copy on the pipeline. The next places the zz string on the pipeline, then $z again, then the $x array in reverse order. All of those are left on the pipeline and output is implicit.

PowerShell v2+, 175 bytes

($x=('AaBbCc','BbCcDd','EeFfGg','HhIiJj','KkLlMm','NnOoPp','QqRrSs','TtUuVv'|%{"$_    "})+'   WwXx   '+'       Yy '|%{$_+-join$_[9..0]})
($z=' '*9+'ZZ')
' '*9+'zz'
$z
$x[9..0]

The first line constructs the branches, with just literal strings in an array concatenated with spaces (that's the first |%{...} loop in the middle), then array-concatenation to add on the WwXx and Yy elements. At this point we have an array of strings like the following.

AaBbCc    
BbCcDd    
EeFfGg    
HhIiJj    
KkLlMm    
NnOoPp    
QqRrSs    
TtUuVv    
   WwXx   
       Yy 
AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       

The next line constructs the ZZ string, saves it into $z, and also encloses in parens to place a copy on the pipeline. The next places the zz string on the pipeline, then $z again, then $x in reverse order.

PowerShell v2+, 175 169 bytes

($x=('AaBbCc','BbCcDd','EeFfGg','HhIiJj','KkLlMm','NnOoPp','QqRrSs','TtUuVv'|%{"$_    "})+'   WwXx   '+'       Yy '+(' '*9+'Z')|%{$_+-join$_[9..0]})
' '*9+'zz'
$x[10..0]

The first line constructs the branches, with just literal strings in an array concatenated with spaces (that's the first |%{...} loop in the middle), then array-concatenation to add on the WwXx, Yy, and Z elements. At this point we have an array of strings like the following (one element per line).

AaBbCc    
BbCcDd    
EeFfGg    
HhIiJj    
KkLlMm    
NnOoPp    
QqRrSs    
TtUuVv    
   WwXx   
       Yy 
         Z
AaBbCc        cCbBaA
BbCcDd        dDcCbB
EeFfGg        gGfFeE
HhIiJj        jJiIhH
KkLlMm        mMlLkK
NnOoPp        pPoOnN
QqRrSs        sSrRqQ
TtUuVv        vVuUtT
   WwXx      xXwW   
       Yy  yY       
         ZZ         

The next places the zz string on the pipeline, then the $x array in reverse order. All of those are left on the pipeline and output is implicit.

Source Link
AdmBorkBork
  • 43.5k
  • 5
  • 103
  • 284
Loading