The crazy “denziens” of rec.games.roguelike.development have announced the new, sadistic challenge of writing a roguelike in less than 1KibiBytes of source code!
Here goes some samples, proceed to rgrd to see more and submit yours!:
LUCK by “yours truly” (Java)
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);}}
Pink Warrior, by Jurgen Lerch
PROGRAM p;USES Graph;CONST c=319;l=199;f=15;VAR k:CHAR;d:ARRAY[0..c,0..l]OF SMALLINT;w,z:ARRAY[0..11]OF SMALLINT; n,u,v,x,y:SMALLINT;BEGIN x:=f;y:=30001;InitGraph(x,y,''); FOR x:=0 TO c DO BEGIN d[x,0]:=f;d[x,l]:=f END;FOR y:=0 TO l DO BEGIN d[0,y]:=f;d[c,y]:=f END;FOR n:=0 TO 3456 DO d[Random(c),Random(l)]:=f; FOR n:=0 TO 11 DO BEGIN w[n]:=Random(c);z[n]:=Random(l) END; FOR x:=0 TO c DO FOR y:=0 TO l DO PutPixel(x,y,d[x,y]); x:=160;y:=100;PutPixel(x,y,13);REPEAT Read(k);PutPixel(x,y,0); CASE k OF'8':IF d[x,y-1]<>f THEN DEC(y);'2':IF d[x,y+1]<>f THEN INC(y); '4':IF d[x-1,y]<>f THEN DEC(x);'6':IF d[x+1,y]<>f THEN INC(x); END;FOR n:=0 TO 11 DO IF(x=w[n])AND(y=z[n])THEN w[n]:=-1; PutPixel(x,y,13);FOR n:=0 TO 11 DO BEGIN u:=w[n];v:=z[n];IF u>0 THEN BEGIN PutPixel(u,v,0);CASE Random(4)OF 0:IF d[u,v-1]<>f THEN DEC(z[n]); 1:IF d[u,v+1]<>f THEN INC(z[n]);2:IF d[u-1,v]<>f THEN DEC(w[n]); 3:IF d[u+1,v]<>f THEN INC(w[n]);END;PutPixel(w[n],z[n],4);IF(w[n]=x) AND(z[n]=y)THEN k:=#27;END END;UNTIL k=#27;CloseGraph;END.
Energon Absorber by Numeron
class M{static char m[][]=new char[10][10];static int k,X=5,Y=5,x,y,a,b,s,t,e=10;public static void main(String[] A)throws Exception{for(;y<10;y++)for(x=0;x<10;x++){if(m[x][y]!='e'){m[x] [y]='.';if(Math.random()<.1&&e>0&&!(x==5&&y==5)){m[x] [y]='e';e--;}}if(x==9&&y==9&&e>0)x=y=0;}m[X][Y]='@';while(true) {e=0;for(y=0;y<m[0].length;y++){for(x=0;x<m.length;x++) {System.out.print(m[x][y]);if(m[x][y]=='e')e+ +;}System.out.println();}if(e!=0)System.out.println("t:"+t+" e:"+e +"n");else System.out.println("U Win! t:"+t +"n");k=System.in.read();if(e==0)System.exit(0);m[X] [Y]='.';if(k==50&&Y!=9){Y++;if(e!=0)t++;}if(k==52&&X!=0){X--;if(e!=0)t+ +;}if(k==54&&X!=9){X++;if(e!=0)t++;}if(k==56&&Y!=0){Y--;if(e!=0)t+ +;}m[X][Y]='@';}}}
That ROCKS!!! … I’ll give it a try!
LikeLike
I tried Pink Warrior, but there seem to be two small bugs (either here produced by the blog display or in the source itself): Instead of ‘ for delimiting strings, the one time a single ” (quotation mark is used) and another time two ´ ´ (accent markers). Don’t know if other Pascal dialects support this syntax, my FreePascal did not 😉
LikeLike
Would rather not have to sign up for Google Groups just to run the entries easily.
LikeLike
You don’t need to sign up into anything in order to view usenet.
LikeLike
Congratulations on knowing exactly what the Usenet is and how to access it. I was referring to the link posted. It was a mild suggestion to the author to offer a web link that didn’t need registration.
LikeLike
Still, you dont need to log into the google usenet web-client to view posts and download code. I mildly suggest that you use your own usenet client instead if google is causing you problems.
LikeLike
Thanks for the input. I’d rather not hunt down a free + working Usenet server and learn how to use a newsreader. In order to make this excellent contest more available to the general public there really should be a link to binaries via the web. That was my suggestion. No registration only groups or arcane forms of Internet use – just web links for the common man. Why keep this to the Usenet savvy? It’s a great idea for a contest. Just a little more effort on the original topics authors part is all I was suggesting.
LikeLike
http://1024brl.googlepages.com/
peace!
LikeLike