Skip to main content
added 19 characters in body
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484

APL (Dyalog Unicode), 40 36 35 33 2727 25 bytes

(⍉⊖⍪1↓⊢)⍣2∘↑⍳↓¨∘⊂1↓'⍣2∘↑⍳↓¨∘⊂'* *'⍴⍨+⍨'⍴⍨+⍨ 

Assumes ⎕IO←0, i.e. zero-based indexing. The output contains one leading and one trailing spaces on each line.

Many thanks to @FrownyFrog and @ngn for lots of golfing.

Try it online!Try it online!

How it works

(⍉⊖⍪1↓⊢)⍣2∘↑⍳↓¨∘⊂1↓'⍣2∘↑⍳↓¨∘⊂'* *'⍴⍨+⍨'⍴⍨+⍨ ⍝ Main function train   ''* *'⍴⍨+⍨'⍴⍨+⍨ ⍝ Repeat ''* *'' up to length 2×⍵ 1↓ ⍝ Drop first char ⍳↓¨∘⊂  ⍝ Generate lower-right corner of the hexagon ∘↑  ⍝ Convert to matrix (⍉⊖⍪1↓⊢)  ⍝ Palindromize vertically and transpose ⍣2  ⍝ ... twice 

APL (Dyalog Unicode), 40 36 35 33 27 bytes

(⍉⊖⍪1↓⊢)⍣2∘↑⍳↓¨∘⊂1↓' *'⍴⍨+⍨ 

Assumes ⎕IO←0, i.e. zero-based indexing.

Many thanks to @FrownyFrog for lots of golfing.

Try it online!

How it works

(⍉⊖⍪1↓⊢)⍣2∘↑⍳↓¨∘⊂1↓' *'⍴⍨+⍨ ⍝ Main function train   ' *'⍴⍨+⍨ ⍝ Repeat ' *' up to length 2×⍵ 1↓ ⍝ Drop first char ⍳↓¨∘⊂  ⍝ Generate lower-right corner of the hexagon ∘↑  ⍝ Convert to matrix (⍉⊖⍪1↓⊢)  ⍝ Palindromize vertically and transpose ⍣2  ⍝ ... twice 

APL (Dyalog Unicode), 40 36 35 33 27 25 bytes

(⍉⊖⍪1↓⊢)⍣2∘↑⍳↓¨∘⊂'* '⍴⍨+⍨ 

Assumes ⎕IO←0, i.e. zero-based indexing. The output contains one leading and one trailing spaces on each line.

Many thanks to @FrownyFrog and @ngn for lots of golfing.

Try it online!

How it works

(⍉⊖⍪1↓⊢)⍣2∘↑⍳↓¨∘⊂'* '⍴⍨+⍨ ⍝ Main function train '* '⍴⍨+⍨ ⍝ Repeat '* ' up to length 2×⍵ ⍳↓¨∘⊂ ⍝ Generate lower-right corner of the hexagon ∘↑ ⍝ Convert to matrix (⍉⊖⍪1↓⊢) ⍝ Palindromize vertically and transpose ⍣2 ⍝ ... twice 
deleted 232 characters in body
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484

APL (Dyalog Unicode), 40 36 35 3333 27 bytes

g←⌽,0 1↓⊢ {g⍉g⍉↑⍵}⍳↓¨∘⊂1↓'(⍉⊖⍪1↓⊢)⍣2∘↑⍳↓¨∘⊂1↓' *'⍴⍨+⍨ 

Assumes ⎕IO←0, i.e. zero-based indexing.

Many thanks to @FrownyFrog for lots of golfing.

Try it online!Try it online!

How it works

g←⌽,0 1↓⊢ ⍝ Auxiliary train for backward-palindromize 0 1↓⊢ ⍝ Drop the first column ⌽, (⍉⊖⍪1↓⊢)⍣2∘↑⍳↓¨∘⊂1↓' *'⍴⍨+⍨ Flip the input horizontally and append above toMain thefunction right train {g⍉g⍉↑⍵}⍳↓¨∘⊂1↓' *'⍴⍨+⍨  Main dfn train  ' *'⍴⍨+⍨ ⍝ Repeat ' *' up to length 2×⍵   1↓ ⍝ Drop first char   ⍳↓¨∘⊂ ⍝ Generate lower -right corner of the hexagon {g⍉g⍉↑⍵}  ⍝ Apply the chain of monads: ↑ ∘↑  Convert to matrix  (⍉⊖⍪1↓⊢) ⍉g⍉  Palindromize vertically and transpose g ⍣2   Palindromize horizontally... twice 

APL (Dyalog Unicode), 40 36 35 33 bytes

g←⌽,0 1↓⊢ {g⍉g⍉↑⍵}⍳↓¨∘⊂1↓' *'⍴⍨+⍨ 

Assumes ⎕IO←0, i.e. zero-based indexing.

Many thanks to @FrownyFrog for lots of golfing.

Try it online!

How it works

g←⌽,0 1↓⊢ ⍝ Auxiliary train for backward-palindromize 0 1↓⊢ ⍝ Drop the first column ⌽,  Flip the input horizontally and append above to the right  {g⍉g⍉↑⍵}⍳↓¨∘⊂1↓' *'⍴⍨+⍨  Main dfn train  ' *'⍴⍨+⍨ ⍝ Repeat ' *' to length 2×⍵ 1↓ ⍝ Drop first char ⍳↓¨∘⊂ ⍝ Generate lower right corner of the hexagon {g⍉g⍉↑⍵}  ⍝ Apply the chain of monads: ↑   Convert to matrix   ⍉g⍉  Palindromize vertically g  Palindromize horizontally 

APL (Dyalog Unicode), 40 36 35 33 27 bytes

(⍉⊖⍪1↓⊢)⍣2∘↑⍳↓¨∘⊂1↓' *'⍴⍨+⍨ 

Assumes ⎕IO←0, i.e. zero-based indexing.

Many thanks to @FrownyFrog for lots of golfing.

Try it online!

How it works

(⍉⊖⍪1↓⊢)⍣2∘↑⍳↓¨∘⊂1↓' *'⍴⍨+⍨Main function train ' *'⍴⍨+⍨ ⍝ Repeat ' *' up to length 2×⍵   1↓ ⍝ Drop first char   ⍳↓¨∘⊂ ⍝ Generate lower-right corner of the hexagon ∘↑ ⍝ Convert to matrix (⍉⊖⍪1↓⊢) ⍝ Palindromize vertically and transpose ⍣2  ... twice 
added 6 characters in body
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484

APL (Dyalog Unicode), 40 36 35 33 bytes

g←⌽,0 1↓⊢ {g⍉g⍉↑⍵}⍳↓¨∘⊂1↓' *'⍴⍨+⍨ 

Assumes ⎕IO←0, i.e. zero-based indexing.

Many thanks to @FrownyFrog for lots of golfing.

Try it online!

How it works

g←⌽,0 1↓⊢ ⍝ Auxiliary train for backward-palindromize 0 1↓⊢ ⍝ Drop the first column ⌽, ⍝ Flip the input horizontally and append above to the right {g⍉g⍉↑⍵}⍳↓¨∘⊂1↓' *'⍴⍨+⍨ ⍝ Main dfn train ' *'⍴⍨+⍨ ⍝ Repeat ' *' to timeslength 2×⍵ 1↓ ⍝ Drop first char ⍳↓¨∘⊂ ⍝ Generate lower right corner of the hexagon {g⍉g⍉↑⍵} ⍝ Apply the chain of monads: ↑ ⍝ Convert to matrix ⍉g⍉ ⍝ Palindromize vertically g ⍝ Palindromize horizontally 

APL (Dyalog Unicode), 40 36 35 33 bytes

g←⌽,0 1↓⊢ {g⍉g⍉↑⍵}⍳↓¨∘⊂1↓' *'⍴⍨+⍨ 

Assumes ⎕IO←0, i.e. zero-based indexing.

Many thanks to @FrownyFrog for lots of golfing.

Try it online!

How it works

g←⌽,0 1↓⊢ ⍝ Auxiliary train for backward-palindromize 0 1↓⊢ ⍝ Drop the first column ⌽, ⍝ Flip the input horizontally and append above to the right {g⍉g⍉↑⍵}⍳↓¨∘⊂1↓' *'⍴⍨+⍨ ⍝ Main dfn train ' *'⍴⍨+⍨ ⍝ Repeat ' *'  times 1↓ ⍝ Drop first char ⍳↓¨∘⊂ ⍝ Generate lower right corner of the hexagon {g⍉g⍉↑⍵} ⍝ Apply the chain of monads: ↑ ⍝ Convert to matrix ⍉g⍉ ⍝ Palindromize vertically g ⍝ Palindromize horizontally 

APL (Dyalog Unicode), 40 36 35 33 bytes

g←⌽,0 1↓⊢ {g⍉g⍉↑⍵}⍳↓¨∘⊂1↓' *'⍴⍨+⍨ 

Assumes ⎕IO←0, i.e. zero-based indexing.

Many thanks to @FrownyFrog for lots of golfing.

Try it online!

How it works

g←⌽,0 1↓⊢ ⍝ Auxiliary train for backward-palindromize 0 1↓⊢ ⍝ Drop the first column ⌽, ⍝ Flip the input horizontally and append above to the right {g⍉g⍉↑⍵}⍳↓¨∘⊂1↓' *'⍴⍨+⍨ ⍝ Main dfn train ' *'⍴⍨+⍨ ⍝ Repeat ' *' to length 2×⍵ 1↓ ⍝ Drop first char ⍳↓¨∘⊂ ⍝ Generate lower right corner of the hexagon {g⍉g⍉↑⍵} ⍝ Apply the chain of monads: ↑ ⍝ Convert to matrix ⍉g⍉ ⍝ Palindromize vertically g ⍝ Palindromize horizontally 
added 177 characters in body
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484
Loading
added 4 characters in body
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484
Loading
deleted 14 characters in body
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484
Loading
Source Link
Bubbler
  • 79.3k
  • 5
  • 162
  • 484
Loading