Timeline for Square root of ASCII art
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 14, 2017 at 16:10 | history | edited | Jakob | CC BY-SA 3.0 |
formatting
|
Aug 10, 2017 at 12:20 | history | edited | Jakob | CC BY-SA 3.0 |
-2 bytes: alias `h+a+h%2`
|
Aug 10, 2017 at 11:24 | comment | added | Kevin Cruijssen |
Nice answer +1. You can golf 2 bytes by creating a variable for h+a+h%2 which you use two times in your code: l->{int h=l.length,w=l[0].length(),a=h/2,i=w+3,x=h+a+h%2;String s="",t=s;for(;--i>0;)t+="_";for(;i++<x;)s+=" ";t=s+t;for(i=0;i<h;)t+="\n"+s.substring(0,i<a?x+~i:i-a)+(i<a?"":"\\"+s.substring(0,(h+~i)*2))+"/"+s.substring(0,i+1)+l[i++];return t;} . (I also used the header & footer in the TIO link, so you can isolate your actual golfed code from the test code.)
|
|
Aug 10, 2017 at 2:51 | history | answered | Jakob | CC BY-SA 3.0 |