LUCK 3.0, Day 3 of 1

Ok, I must confess I am obsessed.

This is intended to be the final version, I dont think I can manage to get something more into it!

For this version I added:

  • Move using directional keys
  • Added Enemies: They chase you down and quickly reduce your oxygen!
  • Enemies are quicker as you go into the dungeon.
  • Combat against enemies, you can choose to run or face them in deadly hand to flipper combat!
  • Enemies don’t run into walls
  • Press space after you win or lose so you can see your results (really!)
  • Fixed bug on random generation (wasnt working for new levels)

Picture:

LUCK 3.0, Source Code Included
LUCK 3.0, Source Code Included

So far, LUCK is a <1KBRL With the following features

  • Move using the directional keys
  • Pick up at least 10 relics through the 20 dungeon floors
  • Your oxygen drops steadly, your time is limited
  • Line of Sight, risk exploring the dungeon for the relics or descending for better LUCK
  • Random Level Generation
  • Themed Levels
  • Combat hand to hand with progressively harder enemies

Download Executables and Source

The 1023 bytes Java source code follows

import sz.csi.jcurses.*;class D{int a,b,c,d,k,l,o,p,q,w,v,r,
i,e=600,f,h;boolean m[][];int r(){return(int)(Math.random()*
17+1);}int[]s=new int[]{0,0,-1,1,-1,1,0,0};void a(int x,int
y,char h){j.print(x,y,Math.abs(a-x)+Math.abs(b-y)<7?h:' ',1+
v%13);}public static void main(String[]p){new D();}D(){
j.cls();for(;;){if(q==a&w==b){m=new boolean[20][20];for(i=0;
++i<20;){m[r()][r()]=m[0][i]=m[19][i]=m[i][0]=m[i][19]=true;
}q=r();w=r();a=r();b=r();o=r();p=r();v++;m[q][w]=m[o][p]=
false;}if(o==a&p==b){o=40;p=3;r++;}d=-1;while(d++<19){c=-1;
while(c++<19)a(c,d,m[c][d]?'#':'.');}j.print(2,22,"LCK L"+v+
"E"+e+"R"+r+" ",7);j.print(a,b,"@",12);a(q,w,'>');a(o,p,'%'
);a(k,l,'&');i=j.inkey().code;d=s[i%4];c=s[4+i%4];if(a+d==k&
b+c==l){if(r()>8){k=r();l=r();}}else if(!m[a+d][b+c]){a+=d;b
+=c;}f=Integer.signum(a-k);h=Integer.signum(b-l);if(k+f==a&l
+h==b)e-=5;else if(e%(5-(int)(v/4.5d))==0&!m[k+f][l+h]){k+=f
;l+=h;}if(--e<0|v>20)break;}j.print(2,23,r>9?"WON":"DIE",4);
j.waitKey(40);}JCursesConsoleInterface j=new
JCursesConsoleInterface();}

Stats

Aprox. Work Time: 10:00 (6:00+4:00)
Source Files: 1
LOC: 1
SLOC-L: 15

LUCK, day 2 of 1

So, I decided to do further work on my entry for the rgrd First <1KbRL Challenge.

  • Line of Sight (Kind of)
  • Solid cells
  • Themed Levels (:P)
  • Level borders
  • Ensured stairs and artifacts are reachable

You can download it here

Pic

LUCK 2.0, Source Code Included
LUCK 2.0, Source Code Included

Source Code

import sz.csi.jcurses.*;public class C{int xr,yr,xp,yp,q,w,xo,yo,v,r,i,e=500;
boolean m[][]=new boolean[20][20];int r(){return(int)(Math.random()*17+1);}
void a(int x,int y,String h){p(x,y,Math.abs(xp-x)+Math.abs(yp-y)<7?h:" ",1+
(int)(v/2.0d));}void j(int x,int y){if(!m[xp+x][yp+y]){xp+=x;yp+=y;}}public
static void main(String[]p){new C();}public C(){for(;i<20;i++){m[r()][r()]=
m[0][i]=m[19][i]=m[i][0]=m[i][19]=true;}c.cls();o:for(;;){if(xo==xp&yo==yp){
xo=40;yo=3;r++;}if(q==xp&w==yp){q=r();w=r();xp=r();yp=r();xo=r();yo=r();v++;
m[q][w]=m[xo][yo]=false;}yr=-1;while(yr++<19){xr=-1;while(xr++<19)a(xr,yr,m[
xr][yr]?"#":".");}p(2,22,"LUCK! Slash > L"+v+" E"+e+" R"+r+" ",7);p(xp,yp,
"@",12);a(q,w,">");a(xo,yo,")");switch(c.inkey().code){case 112:j(0,-1);
break;case 108:j(0,1);break;case 90:j(-1,0);break;case 93:j(1,0);break;case
40:break o;}if(--e==0)break o;if(v==21){if(r>=10)p(2,23,"WON "+(r-10),4);
break o;}}}JCursesConsoleInterface c=new JCursesConsoleInterface();void p(int
x,int y,String m,int o){c.print(x,y,m,o);}}

Stats

Aprox. Work Time: 6:00 (3:00+3:00)
Source Files: 1
LOC: 1
SLOC-L: 15

“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!

DOWNLOAD VERSION 1.0

Features
* No combat, survive and win

Quickstart
* 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!

Plot
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)
{xo=21+v;yo=3;r++;}if(xs==xp&ys==yp){xs=r();ys=r();xp=r();yp=r();
xo=r();yo=r();v++;}yr=0;while(yr<20){xr=0;while(xr<20){p(yr,
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);}}

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