Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 3 4 [5] 6
  ignore  |  Print  
  TinyCode competition - trial  (Read 28039 times)
0 Members and 1 Guest are viewing this topic.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #120 - Posted 2007-11-01 09:03:13 »

Thanks, I already thought of this one, and expected everyone would do
1  
byte[] b=new byte[99];

With a double for-loop..


Anyway, we'll see who can do it in 1 for-loop Smiley

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #121 - Posted 2007-11-01 09:36:11 »

http://213.247.55.3:8484/compileandrun/?assignment=reverse
(85 bytes, with 1 for-loop, very hard) Sad
(83 bytes, with 2 while-loops, extremely simple)

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Abuse

JGO Knight


Medals: 13


falling into the abyss of reality


« 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 Grin

(no peeking @ the solution Riven Cool)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #123 - Posted 2007-11-01 10:13:01 »

I'll behave this time... Kiss

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Abuse

JGO Knight


Medals: 13


falling into the abyss of reality


« Reply #124 - Posted 2007-11-01 10:15:33 »

[hint]
you don't need to declare a stack
[/hint]
 Grin

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #125 - Posted 2007-11-01 10:23:28 »

How many bytes?  Lips Sealed

(Should I be worrying about a StackOverflowException Wink)

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Abuse

JGO Knight


Medals: 13


falling into the abyss of reality


« Reply #126 - Posted 2007-11-01 10:29:24 »

How many bytes?  Lips Sealed

(Should I be worrying about a StackOverflowException Wink)

Sounds like you are on the right track Grin
I think it's a more scalable solution than one using a stack of byte[99] Wink

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« 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
Offline 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. Smiley
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« 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!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« 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
Offline Martin Strand

Junior Duke





« 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 Smiley
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« 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. Angry

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline timfoden

Junior Duke


Projects: 2



« 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.

Try Pipe Extreme -- can you get to the end of the pipe?
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« 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
Offline JuddMan

Senior Duke


Medals: 1


Your Ad Here


« 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.
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #136 - Posted 2007-11-16 18:06:32 »

I got 52 bytes for the BitEncoder. No idea how to optimze further...

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« 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 Sad



Oh... ehm... I just noticed the SQL connection got a broken pipe after 1 day Smiley 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
Offline timfoden

Junior Duke


Projects: 2



« Reply #138 - Posted 2007-11-20 08:27:57 »

Hi Riven,

It looks like the connection has gone again. Smiley

Cheers, Tim.

Try Pipe Extreme -- can you get to the end of the pipe?
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« 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
Offline 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);
}
Offline 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);
}
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« 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 Wink

If only I had some free time to build this into a proper 'service'... Roll Eyes

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #143 - Posted 2007-12-27 16:57:26 »

Yeah, it's kinda weird how creating butt-ugly code can feel so satisfying  Grin

Offline noblemaster

JGO Ninja


Medals: 20
Projects: 10


Age of Conquest makes your day!


« Reply #144 - Posted 2009-10-20 00:44:59 »

So the server went offline for good or is the project alive somewhere else?  Cry

Also, was the server even been hacked or did your code successfully prevent that?

Offline Abuse

JGO Knight


Medals: 13


falling into the abyss of reality


« Reply #145 - Posted 2009-10-20 02:46:34 »

So the server went offline for good or is the project alive somewhere else?  Cry

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.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« 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 Wink

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline noblemaster

JGO Ninja


Medals: 20
Projects: 10


Age of Conquest makes your day!


« Reply #147 - Posted 2009-10-20 08:49:44 »

Looking forward to it  Grin

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #148 - Posted 2010-04-15 17:55:28 »

Any day now! Grin

Sneek preview

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Markus_Persson

JGO Wizard


Medals: 16
Projects: 19


Mojang Specifications


« Reply #149 - Posted 2010-04-15 18:16:36 »

That's looking mighty good! Cheesy

Play Minecraft!
Pages: 1 ... 3 4 [5] 6
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (45 views)
2014-10-17 03:59:02

Norakomi (35 views)
2014-10-16 15:22:06

Norakomi (27 views)
2014-10-16 15:20:20

lcass (31 views)
2014-10-15 16:18:58

TehJavaDev (61 views)
2014-10-14 00:39:48

TehJavaDev (61 views)
2014-10-14 00:35:47

TehJavaDev (51 views)
2014-10-14 00:32:37

BurntPizza (67 views)
2014-10-11 23:24:42

BurntPizza (39 views)
2014-10-11 23:10:45

BurntPizza (81 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!