Riven
|
 |
«
Reply #120 - Posted
2007-11-01 09: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
|
 |
«
Reply #122 - Posted
2007-11-01 10: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! Check 'em out!
|
|
Riven
|
 |
«
Reply #123 - Posted
2007-11-01 10: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
|
 |
«
Reply #124 - Posted
2007-11-01 10:15:33 » |
|
[hint] you don't need to declare a stack [/hint] 
|
|
|
|
Riven
|
 |
«
Reply #125 - Posted
2007-11-01 10: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
|
 |
«
Reply #126 - Posted
2007-11-01 10: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
|
 |
«
Reply #127 - Posted
2007-11-01 10:34:28 » |
|
Weeee.... 53?
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
markush
Senior Newbie 
Plöp!
|
 |
«
Reply #128 - Posted
2007-11-01 10: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
|
 |
«
Reply #129 - Posted
2007-11-01 10: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! Check 'em out!
|
|
Riven
|
 |
«
Reply #130 - Posted
2007-11-01 11: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
|
 |
«
Reply #131 - Posted
2007-11-01 22: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
|
 |
«
Reply #132 - Posted
2007-11-04 22: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
|
 |
«
Reply #133 - Posted
2007-11-05 12: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
|
 |
«
Reply #134 - Posted
2007-11-05 16: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
|
 |
«
Reply #135 - Posted
2007-11-16 15:06:40 » |
|
this is pretty cool, but i am no good at optimizing. my attempt at the capitalizer was 113 bytes.
|
|
|
|
erikd
|
 |
«
Reply #136 - Posted
2007-11-16 18:06:32 » |
|
I got 52 bytes for the BitEncoder. No idea how to optimze further...
|
|
|
|
Riven
|
 |
«
Reply #137 - Posted
2007-11-17 11: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
|
 |
«
Reply #138 - Posted
2007-11-20 08:27:57 » |
|
Hi Riven, It looks like the connection has gone again.  Cheers, Tim.
|
|
|
|
Riven
|
 |
«
Reply #139 - Posted
2007-11-21 18: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
|
 |
«
Reply #140 - Posted
2007-12-27 05: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
|
 |
«
Reply #141 - Posted
2007-12-27 05: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
|
 |
«
Reply #142 - Posted
2007-12-27 07: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
|
 |
«
Reply #143 - Posted
2007-12-27 16:57:26 » |
|
Yeah, it's kinda weird how creating butt-ugly code can feel so satisfying 
|
|
|
|
noblemaster
|
 |
«
Reply #144 - Posted
2009-10-20 00: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
|
 |
«
Reply #145 - Posted
2009-10-20 02: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
|
 |
«
Reply #146 - Posted
2009-10-20 07: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
|
 |
«
Reply #147 - Posted
2009-10-20 08:49:44 » |
|
Looking forward to it 
|
|
|
|
|
Markus_Persson
|
 |
«
Reply #149 - Posted
2010-04-15 18:16:36 » |
|
That's looking mighty good! 
|
|
|
|
|