APL: 59
This function accepts a number and returns the two expected items. Works correctly in bonus cases.
{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1}
Dialect is Dyalog APL, with default index origin. Skill level is clueless newbie, so if any APL guru wants to bring it down to 10 characters, be my guest!
You can try it online on Try APL, just paste it in and put a number after it:
{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1} 13
┌→────────────────────────┐
↓ ************* │
│ ******************* │
│ ********************* │
│ *********************** │
│*************************│*************************
│*************************│*************************
│*************************│*************************
│*************************│*************************
│ *********************** │
│ ********************* │
│ ******************* │
│ ************* ↓
├────────────────────────→┤
│22.98225 │
└~────────────────────────┘
APL: 59
This function accepts a number and returns the two expected items. Works correctly in bonus cases.
{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1}
Dialect is Dyalog APL, with default index origin. Skill level is clueless newbie, so if any APL guru wants to bring it down to 10 characters, be my guest!
You can try it online on Try APL, just paste it in and put a number after it:
{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1} 13
┌→────────────────────────┐
↓ ************* │
│ ******************* │
│ ********************* │
│ *********************** │
│*************************│
│*************************│
│*************************│
│*************************│
│ *********************** │
│ ********************* │
│ ******************* │
│ ************* ↓
├────────────────────────→┤
│2.98225 │
└~────────────────────────┘
APL: 59
This function accepts a number and returns the two expected items. Works correctly in bonus cases.
{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1}
Dialect is Dyalog APL, with default index origin. Skill level is clueless newbie, so if any APL guru wants to bring it down to 10 characters, be my guest!
You can try it online on Try APL, just paste it in and put a number after it:
{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1} 13
*************
*******************
*********************
***********************
*************************
*************************
*************************
*************************
***********************
*********************
*******************
*************
2.98225
APL: 59
This function accepts a number and returns the two expected items. Works correctly in bonus cases.
{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1}
Dialect is Dyalog APL, with default index origin. Skill level is clueless newbie, so if any APL guru wants to bring it down to 10 characters, be my guest!
You can try it online on Try APL, just paste it in and put a number after it:
{⍪(⊂' *'[1+m])×ばつ+/,m←(2|v)⌿(q←⍵*2)&g×ばつ⍵-1} 13
┌→────────────────────────┐
↓ ************* │
│ ******************* │
│ ********************* │
│ *********************** │
│*************************│
│*************************│
│*************************│
│*************************│
│ *********************** │
│ ********************* │
│ ******************* │
│ ************* ↓
├────────────────────────→┤
│2.98225 │
└~────────────────────────┘