Skip to main content
Handle empty string
Source Link
doug
  • 1.4k
  • 3
  • 9

K (ngn/k), 337 331 315 290 279 231 224 211211 213 bytes

{(x,w)#@[(x*w)#" ";i,*|i;:;@["|-"{1=x|1|1=x|-x}@-':i:0,+\(,/-:\1,w:-1+2*x)4!2_&s;(-2_-2+\s;!#y);:;(".''."4!!-2+#s:,/+|1(2*1+)\|!x; y:,/((#l)#("-";"")){x/y}',''l:(0,((#y)>)#+\(0,(-1+#l)#-1 1)+l:1_|1+&x#2)_y)],"<>"2!x]}

Try it online!Try it online!

-6 : Save a few bytes with shorter names.
-16 : Tidying up
-25 : Cruft
-46 : Golfing gets me back under limits
-7 : Cleaner
-13 : A single statement!
+2 : handle empty string

K (ngn/k), 337 331 315 290 279 231 224 211 bytes

{(x,w)#@[(x*w)#" ";i,*|i;:;@["|-"{1=x|-x}@-':i:0,+\(,/-:\1,w:-1+2*x)4!2_&s;(-2_-2+\s;!#y);:;(".''."4!!-2+#s:,/+|1(2*1+)\|!x; y:,/((#l)#("-";"")){x/y}',''l:(0,((#y)>)#+\(0,(-1+#l)#-1 1)+l:1_|1+&x#2)_y)],"<>"2!x]}

Try it online!

-6 : Save a few bytes with shorter names.
-16 : Tidying up
-25 : Cruft
-46 : Golfing gets me back under limits
-7 : Cleaner
-13 : A single statement!

K (ngn/k), 337 331 315 290 279 231 224 211 213 bytes

{(x,w)#@[(x*w)#" ";i,*|i;:;@["|-"{1|1=x|-x}@-':i:0,+\(,/-:\1,w:-1+2*x)4!2_&s;(-2_-2+\s;!#y);:;(".''."4!!-2+#s:,/+|1(2*1+)\|!x; y:,/((#l)#("-";"")){x/y}',''l:(0,((#y)>)#+\(0,(-1+#l)#-1 1)+l:1_|1+&x#2)_y)],"<>"2!x]}

Try it online!

-6 : Save a few bytes with shorter names.
-16 : Tidying up
-25 : Cruft
-46 : Golfing gets me back under limits
-7 : Cleaner
-13 : A single statement!
+2 : handle empty string

Somehow the link was wrong
Source Link
doug
  • 1.4k
  • 3
  • 9

K (ngn/k), 337 331 315 290 279 231 224224 211 bytes

{t(x,w)#@[(x*w)#" ";i,*|i;:@["|;@["|-"{1=x|-x}@-':i:0,+\(,/-:\1,w:-1+2*x)4!2_&s;(-2_-2+\s;!#y);:;(".''."4!!-2+#s:,/+|1(2*1+)\|!x;yx; y:,/((#l)#("-";"")){x/y}',''l:(0,((#y)>)#+\(0,(-1+#l)#-1 1)+l:1_|1+&x#2)_y)];-2+\s;(x],w)#@[(x*w)#" ";(i;*|i);:;(t;"<>"2"<>"2!x)]x]}

Try it online! Try it online!

-6 : Save a few bytes with shorter names.
-16 : Tidying up
-25 : Cruft
-46 : Golfing gets me back under limits
-7 : Cleaner
-13 : A single statement!

K (ngn/k), 337 331 315 290 279 231 224 bytes

{t:@["|-"{1=x|-x}@-':i:0,+\(,/-:\1,w:-1+2*x)4!2_&s;(-2_-2+\s;!#y);:;(".''."4!!-2+#s:,/+|1(2*1+)\|!x;y:,/((#l)#("-";"")){x/y}',''l:(0,((#y)>)#+\(0,(-1+#l)#-1 1)+l:1_|1+&x#2)_y)];-2+\s;(x,w)#@[(x*w)#" ";(i;*|i);:;(t;"<>"2!x)]}

Try it online! -6 : Save a few bytes with shorter names.
-16 : Tidying up
-25 : Cruft
-46 : Golfing gets me back under limits
-7 : Cleaner

K (ngn/k), 337 331 315 290 279 231 224 211 bytes

{(x,w)#@[(x*w)#" ";i,*|i;:;@["|-"{1=x|-x}@-':i:0,+\(,/-:\1,w:-1+2*x)4!2_&s;(-2_-2+\s;!#y);:;(".''."4!!-2+#s:,/+|1(2*1+)\|!x; y:,/((#l)#("-";"")){x/y}',''l:(0,((#y)>)#+\(0,(-1+#l)#-1 1)+l:1_|1+&x#2)_y)],"<>"2!x]}

Try it online!

-6 : Save a few bytes with shorter names.
-16 : Tidying up
-25 : Cruft
-46 : Golfing gets me back under limits
-7 : Cleaner
-13 : A single statement!

Go to the original construction to find the corners.
Source Link
doug
  • 1.4k
  • 3
  • 9

K (ngn/k), 337 331 315 290 279 231231 224 bytes

{t:@["|-"{1=x|-x}d;(-1+&~^l;!#y);:;("..''"(~^:)#l:s?*/1(~=':)\d:@-':i:0,+\(s:,/-:\1,w:-1+2*x)4!2_&2_&s;(-2_-2+\s;!#y);:;(".''."4!!-2+#s:,/+|1(2*1+)\|!x;y:,/((#l)#("-";"")){x/y}',''l:(0,((#y)>)#+\(0,(-1+#l)#-1 1)+l:1_|1+&x#2)_y)];-2+\s;(x,w)#@[(x*w)#" ";(i;*|i);:;(t;"<>"2!x)]}

Try it online!Try it online! -6 : Save a few bytes with shorter names.
-16 : Tidying up
-25 : Cruft
-46 : Golfing gets me back under limits
-7 : Cleaner

K (ngn/k), 337 331 315 290 279 231 bytes

{t:@["|-"{1=x|-x}d;(-1+&~^l;!#y);:;("..''"(~^:)#l:s?*/1(~=':)\d:-':i:0,+\(s:,/-:\1,w:-1+2*x)4!2_&,/+|1(2*1+)\|!x;y:,/((#l)#("-";"")){x/y}',''l:(0,((#y)>)#+\(0,(-1+#l)#-1 1)+l:1_|1+&x#2)_y)];(x,w)#@[(x*w)#" ";(i;*|i);:;(t;"<>"2!x)]}

Try it online! -6 : Save a few bytes with shorter names.
-16 : Tidying up
-25 : Cruft
-46 : Golfing gets me back under limits

K (ngn/k), 337 331 315 290 279 231 224 bytes

{t:@["|-"{1=x|-x}@-':i:0,+\(,/-:\1,w:-1+2*x)4!2_&s;(-2_-2+\s;!#y);:;(".''."4!!-2+#s:,/+|1(2*1+)\|!x;y:,/((#l)#("-";"")){x/y}',''l:(0,((#y)>)#+\(0,(-1+#l)#-1 1)+l:1_|1+&x#2)_y)];-2+\s;(x,w)#@[(x*w)#" ";(i;*|i);:;(t;"<>"2!x)]}

Try it online! -6 : Save a few bytes with shorter names.
-16 : Tidying up
-25 : Cruft
-46 : Golfing gets me back under limits
-7 : Cleaner

Inlining allows reuse.
Source Link
doug
  • 1.4k
  • 3
  • 9
Loading
Bought some room with golfing to chuck one helper
Source Link
doug
  • 1.4k
  • 3
  • 9
Loading
Last bit??
Source Link
doug
  • 1.4k
  • 3
  • 9
Loading
Overzealous editing
Source Link
doug
  • 1.4k
  • 3
  • 9
Loading
Junk left in from earlier attempts
Source Link
doug
  • 1.4k
  • 3
  • 9
Loading
Junk left in from earlier attempts
Source Link
doug
  • 1.4k
  • 3
  • 9
Loading
Various cleanup
Source Link
doug
  • 1.4k
  • 3
  • 9
Loading
Source Link
doug
  • 1.4k
  • 3
  • 9
Loading