“LUCK”, day 1 of 1

Ok, this is my entry for the <1KBRL challenge, in which developers wrote roguelikes with a source code of less than 1000 bytes!


* No combat, survive and win

* Use WASD to move,  ‘ ‘ to exit.
* Get the relics from each floor and run for the exit, your time is limited as you are running out of oxygen

Almost Winning!
Almost Winning!

It is been about four million years since the times of The Quest for the Amulet of Yendor. The planet has been devastated and traces of civilization are no longer found.

You land your ship near the place the amulet of Yendor is rummored to be.

Your ship soon becomes unstable and you are ejected; your main oxygen tank blows into a million pieces, and you are left with a limited and pretty useless secondary tank.

Having no hope to survive, you jump into the ruins of Yendor, hoping to find at least 10 pieces of the broken amulet, become God, save yourself and turn the planet into a happy greenland.

Source Code

import sz.csi.jcurses.JCursesConsoleInterface;public class X{static
int xr,yr,xp,yp,xs,ys,xo,yo,v,r,i,e=300,s;static boolean map[][]=new
boolean[20][20];static int r(){return (int)(Math.random()*19.0d);}public
static void main(String[] p){while (i < 20){map[r()][r()]=true;i++;}c.cls();
p(21,1,”Slash1KBRL – LUCK :)!”);o:while(true){if(xo==xp&yo==yp)
xr,map[xr][yr]?”#”:”.”);xr++;}yr++;}p(2,22,”L”+v+” R”+r+” E”+e+”  “);
p(xp,yp,”@”);p(xs,ys,”>”);p(xo,yo,”)”);switch(c.inkey().code){case 112:
yp–;break;case 108:yp++;break;case 90:xp–;break;case 93:xp++;
break;case 40:break o;}e–;if(e==0){p(2,23,”LOST”);break o;}if(v==20)
{s=10-r;if(s>0)p(2,23,”LOSER”);else p(2,23,”WON “+s);break o;}}}
static JCursesConsoleInterface c = new JCursesConsoleInterface();
static void p(int x,int y,String m){c.print(x, y, m);}}

Aprox. Work Time: 3:00
Source Files: 1
LOC: 36
SLOC-L: 32

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s