Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #120 on:
2007-11-01 05:03:13 » |
|
Thanks, I already thought of this one, and expected everyone would do With a double for-loop.. Anyway, we'll see who can do it in 1 for-loop 
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
|
|
Abuse
JGO Kernel      Posts: 1866 Medals: 5
falling into the abyss of reality
|
 |
«
Reply #122 on:
2007-11-01 06:12:02 » |
|
You've a long way to go yet! (53 bytes) Nothing like throwing weighted dice to make sure you win  (no peeking @ the solution Riven  )
|
|
|
|
|
Games published by our own members! Go get 'em!
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #123 on:
2007-11-01 06:13:01 » |
|
I'll behave this time... 
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
Abuse
JGO Kernel      Posts: 1866 Medals: 5
falling into the abyss of reality
|
 |
«
Reply #124 on:
2007-11-01 06:15:33 » |
|
[hint] you don't need to declare a stack [/hint] 
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #125 on:
2007-11-01 06:23:28 » |
|
How many bytes?  (Should I be worrying about a StackOverflowException  )
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
Abuse
JGO Kernel      Posts: 1866 Medals: 5
falling into the abyss of reality
|
 |
«
Reply #126 on:
2007-11-01 06:29:24 » |
|
How many bytes?  (Should I be worrying about a StackOverflowException  ) Sounds like you are on the right track  I think it's a more scalable solution than one using a stack of byte[99] 
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #127 on:
2007-11-01 06:34:28 » |
|
Weeee.... 53?
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
markush
Jr. Member   Posts: 52
Plöp!
|
 |
«
Reply #128 on:
2007-11-01 06:44:37 » |
|
got 54 in reverse with a correct comparison c>-1 and 53 with the slightly incorrect one c>0 Was pretty easy to get there. 
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #129 on:
2007-11-01 06:49:35 » |
|
And here was my initial attempt: 1 2 3 4
| int[] a = new int[99]; for(int o=1;o>0;) if((a[o++]=in.read())<0&&(o-=2)>0) out.write(a[o]); |
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
Games published by our own members! Go get 'em!
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #130 on:
2007-11-01 07:02:16 » |
|
That's all for today, I'm going to study my exams again.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
Martin Strand
Jr. Member   Posts: 60
|
 |
«
Reply #131 on:
2007-11-01 18:46:33 » |
|
I was working on this 63 byte solution: 1 2
| byte[] b = new byte[99]; for (int s = in.read(b); s-- > 0; out.write(b[s])); |
but got 53 as soon as you mentioned StackOverflowException 
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #132 on:
2007-11-04 17:53:29 » |
|
At the moment, you can create an account and submissions will be logged to determine how many people did better than you (if any). If you're not logged in, all your submissions will be assigned to the default anonymous user. http://213.247.55.3:8484/compileandrun/I made the statistics abolutely anonymous, so you only see how many people had their *best* solution better/equal/worse than you. No need to post your code again, to prove that you really got it down to so little bytes. All I can say is, that it is a royal PITA to program a dynamic webpage in Java (without a framework). Java is simply not suited to handle much text in your sourcecode. I'm so fed up with Java in this project, that I'm going to convert it to PHP with a Java part that handles the compile&run part. 
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
timfoden
Jr. Member   Posts: 95
|
 |
«
Reply #133 on:
2007-11-05 07:25:08 » |
|
At the moment, you can create an account and submissions will be logged to determine how many people did better than you (if any).
It's great that you've added accounts now. Super work. IMHO, it would be even better if you showed the best/equal/worse statistics next to the names of the challenges in the main /compileandrun/?account page. Then you'd know instantly which ones you needed to work on to try to beat the best score. Cheers, Tim.
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #134 on:
2007-11-05 11:41:00 » |
|
Good idea, I'll do this tonight, before the major overhaul of the site.
I just had my exams, but this week I'm dedicated to a project at school, so again... there is limited time to get things done.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
JuddMan
Sr. Member   Posts: 285
Your Ad Here
|
 |
«
Reply #135 on:
2007-11-16 10:06:40 » |
|
this is pretty cool, but i am no good at optimizing. my attempt at the capitalizer was 113 bytes.
|
|
|
|
|
erikd
JGO Kernel      Posts: 2561 Medals: 7
Maximumisness
|
 |
«
Reply #136 on:
2007-11-16 13:06:32 » |
|
I got 52 bytes for the BitEncoder. No idea how to optimze further...
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #137 on:
2007-11-17 06:46:17 » |
|
Hm... I wonder when I'll have time to finish this one. Having two jobs and a full-time study pretty much consumes all my time  Oh... ehm... I just noticed the SQL connection got a broken pipe after 1 day  Gotta make it reconnect eh? Update: It reconnects now... I already wondered why nobody was registering accounts... I thought it was pretty much dead.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
timfoden
Jr. Member   Posts: 95
|
 |
«
Reply #138 on:
2007-11-20 03:27:57 » |
|
Hi Riven, It looks like the connection has gone again.  Cheers, Tim.
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #139 on:
2007-11-21 13:25:18 » |
|
Yeah... debugging something that happens hours later, aint much fun.
When I have time, I'll convert it all to PHP with a Java backend - as I said earlier.
It should be pretty darn easy and quick to do... but don't hold your breath.
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
woogley
JGO Neuromancer     Posts: 1098 Medals: 5
|
 |
«
Reply #140 on:
2007-12-27 00:03:29 » |
|
I know I'm late, but I just stumbled on this thread and found it very interesting. I'm not very good at it, but I got most challenges down to a decent size.. I had a VERY hard time with the hex one.. I dont know bitwise operators very well, so if some of you could please explain your logic with the hex challenge, I would be grateful for the lesson! here's my solutions: 1. Capitalizer (71 bytes) 1 2 3 4 5
| int a=0,b=0; while ((b=in.read())>=0) { out.write((a<33&&b>96)?b-32:b); a=b; } |
2. Reverse (93 bytes) 1 2 3
| int b[]=new int[4<<6],l=0,x; while ((x=in.read())>=0)b[l++]=x; for (x=l-1;x>=0;x--)out.write(b[x]); |
3. Hex (231 bytes) ( note: for those who are curious about the 4<<6, that's just a cheap way to get a 4-digit-sized buffer (at the time I didn't know the scenarios were not dynamic..) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| int b[] = new int[4<<6]; int x,l = 0,y = 0; while ((x = in.read()) >= 0) b[l++] = x; for (x = 0;x < l;x++) { if (b[x] >= 48 && b[x] <= 57) { if ((x+1)%2 == 0) y+=b[x]-48; else y = b[x]-48<<4; } else { if ((x+1)%2 == 0) y+=b[x]-87; else y+=b[x]-87<<4; } if ((x+1)%2 == 0) { out.write(y); y = 0; } } |
4. ByteSwap (63 bytes) 1 2 3 4 5
| int x; while ((x=in.read())>0) { out.write(in.read()); out.write(x); } |
5. BarcodeReader (90 bytes) 1 2 3 4 5 6 7 8 9 10
| int c = 48,x = 0; while (x > -2) { x = in.read(); if (x == 32 ^ x < 0) { out.write(c); c = 48; } else c++; if (x < 0) x = -2; } |
6. BinaryShrink (112 bytes) 1 2 3 4 5 6 7 8 9 10
| int x,y,z; while ((x = in.read()) >= 0) { y = 7; z = 0; do { z+=(1<<(y--))*(x-48); if (y >= 0) x = in.read(); } while (y >= 0); out.write(z); } |
7. BitEncoder (62 bytes) 1 2 3 4 5
| int a = 0,x; while ((x = in.read()) > 0) { if (x > 48) a^=1; out.write(a+48); } |
|
|
|
|
|
woogley
JGO Neuromancer     Posts: 1098 Medals: 5
|
 |
«
Reply #141 on:
2007-12-27 00:48:34 » |
|
ok, I managed to get my hex solution down to 133 bytes, but I'm still baffled as to how the rest of you did it: 1 2 3 4 5 6 7 8 9
| int x,y,z = 1; while (z > 0) { y = 0; for (x = 0;x < 2;x++) { if ((z = in.read()) < 58) y+=(x>0?z-48:z-48<<4); else y+=(x>0?z-87:z-87<<4); } if (y > 0) out.write(y); } |
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #142 on:
2007-12-27 02:08:19 » |
|
Nice tries! A bit large answers, but at least your code is butt-ugly, which is what this contest is all about  If only I had some free time to build this into a proper 'service'... 
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
erikd
JGO Kernel      Posts: 2561 Medals: 7
Maximumisness
|
 |
«
Reply #143 on:
2007-12-27 11:57:26 » |
|
Yeah, it's kinda weird how creating butt-ugly code can feel so satisfying 
|
|
|
|
noblemaster
JGO Ninja    Posts: 730 Medals: 6
Age of Conquest makes your day!
|
 |
«
Reply #144 on:
2009-10-19 20:44:59 » |
|
So the server went offline for good or is the project alive somewhere else?  Also, was the server even been hacked or did your code successfully prevent that?
|
|
|
|
Abuse
JGO Kernel      Posts: 1866 Medals: 5
falling into the abyss of reality
|
 |
«
Reply #145 on:
2009-10-19 22:46:34 » |
|
So the server went offline for good or is the project alive somewhere else?  Also, was the server even been hacked or did your code successfully prevent that? Nice resurrection => Nothing like bringing back fond memories from almost 2 years ago.
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #146 on:
2009-10-20 03:55:28 » |
|
Believe it or not, it never left my mind! I've been trying to find the time to make a proper implementation. It's way too much fun! It's not too hard to code it, but coding the whole user-interface and what-not is boring and timeconsuming. Give me a few more weeks 
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
noblemaster
JGO Ninja    Posts: 730 Medals: 6
Age of Conquest makes your day!
|
 |
«
Reply #147 on:
2009-10-20 04:49:44 » |
|
Looking forward to it 
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #148 on:
2010-04-15 13:55:28 » |
|
Any day now! Sneek preview
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings
|
|
|
Markus_Persson
JGO Kernel      Posts: 2092 Medals: 10
Mojang Specifications
|
 |
«
Reply #149 on:
2010-04-15 14:16:36 » |
|
That's looking mighty good! 
|
|
|
|
|