Timeline for Creating a Crossed Square
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 25, 2016 at 14:58 | comment | added | Shaun Wild | @KevinCruijssen Hahaha I guess so >:( | |
Aug 25, 2016 at 13:39 | comment | added | Kevin Cruijssen | Ah sorry. Most of the tips I gave are actually present in the Tips for golfing in Java. I guess I'm just 2quick4u. ;) | |
Aug 25, 2016 at 13:33 | comment | added | Shaun Wild | No point just copying and pasting your golfs, I normally post a quick mock up and then come back to it later on to see if I missed anything that could be golfed. But you RUINED IT FOR MEE :( haha jk | |
Aug 25, 2016 at 13:24 | comment | added | Kevin Cruijssen | Hehe. xD Feel free to use the 116 byte version btw. It's your code, just golfed down some more. ;) My Java 7 answer (which is unfortunately longer) uses a slightly different approach. If I would edit it into the 116 byte version I would basically steal your answer, which I don't want to. | |
Aug 25, 2016 at 13:17 | comment | added | Shaun Wild | @KevinCruijssen I always end up with a shorter answer, but with more room for improvement than you LMAO. Well golfed my friend. | |
Aug 25, 2016 at 12:59 | comment | added | Kevin Cruijssen |
+1! I would specify that it's Java 8, btw. Also, you can golf it a bit by removing the int before j and use int i=0,j; instead. You can also replace all || with | and remove the parenthesis in the ternary-check. Also, you use s-1 four times, so I would put this in a variable. Also, you can change the ==0 to <1 . So in total it becomes s->{for(int i=0,j,x=s-1;i<s;i++)for(j=0;j<s;j++)System.out.print(x-i==j|i==j|i<1|j<1|i==x|j==x?j==x?"*\n":"*":" ");} (116 bytes) Quite a bit shorter than my Java 7 answer, so nice approach!
|
|
Aug 25, 2016 at 12:45 | history | answered | Shaun Wild | CC BY-SA 3.0 |