Category Archives: 1KBRLs

September ’09 Independant <1KBRL Fest

So, last month some individual took a chance at developing their own <1KBRLs. While this was not publicized as a community event, here you have the results of their work, all 6 of them!

Dead!

Dead!

1/2KB RL by Sfuerst

Back in 2006 I made the 2KiB roguelike, the first of the really small roguelikes.  I then left the roguelike world for a few years.  [I] noticed that others have taken up the challenge, and there now are a few 1KiB roguelikes, half the size of the original.  Not to be out done, I then endeavoured to make another halving, and create a roguelike that was less than 512 bytes of source code.

#include<stdlib.h>#define F(n)for(j=0;j<n;j++)#define r ran
d()int main(){int x,s=46,n,i,j,z=77,l[z];char m[z*s],h[z];i
nitscr();raw();F(z*s)j[m]=35;F(s)for(j[l]=i=(r%4+3)*z+(n=r%
17*z+r%s+z);n<=i;n+=z)for(x=n;x<=n+j/2;m[++x]=s);F(9)l[j][m
]=z,j[h]=2;m[*l]=64;*h=5;l[j][m]=62;F(z){x=n=l[i++,i%=9];if
(i)!i[h]||*l^(n+=r%3+r%3*z+~z)||--*h?0:abort();else{F(25)mv
addnstr(j,i,m+j*z,z);j=s-getch();m[n+=j/3*z-j%3+153]^62||ma
in();F(9)l[j+1]^n||--h[j+1]||n[m]--;}n[m]^s||(m[l[i]=n]=x[m
],x[m]=s);}}

Flying@ by purplearcanist

All you can do is move through the clouds that are randomly generated.  It will play on the terminal.

import java.io.*;import java.util.*;class hello{String i;Bu
fferedReader I = new BufferedReader(new InputStreamReader(S
ystem.in));Random r = new Random();int X=0,Y=0;hello(){try{
Byte[] x= new Byte[24*78];byte[] y = new byte[24*78];r.next
Bytes(y);do {for(int z=0; z<24; z++) {System.out.println();
for(int Z=0; Z<78; Z++){x[z*Z]=new Byte(y[z*Z]);System.out.
print((X==Z)&&(Y==z)?'@':x[z*Z].intValue()%2==1?'#':' ');}}
i=I.readLine();X+=a("a")?-1:a("d")?1:0;Y+=a("w")?-1:a("s")?
1:0;}while(!a("q"));}catch(IOException e){}}public boolean
a(String v){return i.equals(v);}public int b(Byte n){return
n.intValue();}public static void main(){hello h = new hello
();}}

Walled @ by Gelatinous Mutant Coconut

It’s pretty simple at this point: You’re an @ in an empty rectangular room surrounded by walls on all sides, and can move around by pressing 1 2 3 4 6 7 8 or 9, until you get bored. Press escape to quit.

#define R ((r=69069*r+1234567)<0?~r:r)
#define L i=a+1;while(--i)
#define _ m[i]
int main(){initscr();raw();int r=380116160,w=80,h=22,a=w*h,
m[a],u=99,c=7,i;do{i=49-c?50-c?51-c?52-c?54-c?55-c?56-c?57-
c?u:u-w-1:u-w:u-w+1:u-1:u+1:u+w-1:u+w:u+w+1;u=_-35?i:u;L{_=
i-u?i>w&&i<a-w&&i%w&&(i-1)%w?46:35:64;}L{i%w?addch(_):mvadd
ch(i/w,0,_);};}while((c=getch())-27);endwin();}

C# <1kB RogueLike v4.1 by Nik Coughlin

A year or so after the challenge a <512byte Roguelike was posted to the group. This brought about a renewed interest, with others posting new 1kB RogueLikes. I decided to revisit mine and see if any further optimizations could be made, allowing me to add more features.

using System;using System.Collections.Generic;using S=Syste
m.String;partial class L{Dictionary<S,S>d=new Dictionary<S,
S>();int p=9,b=999,x,y,g,u,v,i,j,c;S a="@",w="#",f=".",s=">
",m="M",t;Random r=new Random();L(int l,int h,int k){var e=
new List<S>();while(g++<b*l*2){t=(r.Next(b)-499)+a+(r.Next(
b)-499);e.Add(t);d[t]=m;}d[P]=a;for(;;){u=x;v=y;g=c-96;x+=(
g+2)%3==0?-1:g%3==0?1:0;y+=g>6&&g<10?-1:g>0&&g<4?1:0;t=T(P)
;if(t==m){e.Remove(P);d[P]=f;k++;}R();if(t==s){new L(l+1,h,
k);return;}if(t!=f){x=u;y=v;}d[u+a+v]=f;d[P]=a;for(g=0;g<e.
Count;g++){i=V(e[g],0);j=V(e[g],1);u=i<x?i+1:i>x?i-1:i;v=j<
y?j+1:j>y?j-1:j;t=u+a+v;if(T(t)==f){e[g]=t;d[t]=m;d[i+a+j]=
f;}if(T(t)==a)h--;}if(h<1)return;g=p*2-1;for(j=0;j++<g;){fo
r(i=0;i++<g;){t=T((i-p+x)+a+(j-p+y));u=t==w?l:7;while(u>15)
u-=15;F(u<1?7:u);W(t);}N("");}F(7);N("L"+l+f+"H"+h+f+"K"+k)
;c=I;}}S P{get{return x+a+y;}}S T(S c){return d.ContainsKey
(c)?d[c]:d[c]=r.Next(b*9)<9?s:r.Next(9)<7?f:w;}int V(S c,in
t i){return int.Parse(c.Split('@')[i]);}static void Main(){
new L(1,9,0);E();}}

Zombies Abound by Numeron

Zombies are abound and you WILL die eventually. I guess the only thing left is to deny the fact and grab as much scattered money as you can and try to stave off death for as long as possible…

class M{public static void main(String[]e){Console c=new Co
nsole();int a,b,x=0,r=0,q,p,g=0,t=0,l=1,s=20,h=s,S=s*s,i=35
;int[]z,m=new int[S];M:for(;;l++){p=210;z=new int[S];for(q=
0;q<S;r=(int)(Math.random()*S))m[q++]=q%s<2||q<s||q>S-s||r<
110?i:r<130?36:r<135?43:46;for(q=0;q<4+l*4;r=(int)(Math.ran
dom()*S))if(m[r]!=i&&r!=p){if(q<1)m[r]=62;z[r]=2;q++;}for(;
m[p]!=62;t++){for(q=0;q<S;q++){a=z[q];z[q]=a>0?2:0;x=Math.a
bs(p%s-q%s)<5&&Math.abs(p/s-q/s)<5?1:0;r=m[q];c.print(q%s,q
/s,x<1?r==i?i:46:q==p?64:a>0?90:r,x<1?4:p==q?7:a>0||r==37?2
:r==36?3:r==43?1:7);}c.print(1,s,"L:"+l+" $:"+g+" T:"+t+" @
:"+h+" ",3);if(h<1)break M;r=c.getKey()-48;x=p+(r>0&&r<4?s:
r>6&&r<10?-s:0);x+=r--%3==0?1:(r-3)%3==0?-1:0;a=m[x];if(z[x
]>0){z[x]=0;m[x]=a==46?37:a;}else if(a!=i){p=x;if(a==36)g++
;if(a==43)h++;m[p]=a!=37?46:a;}for(x=0;x<S;x++)if(z[x]>1){q
=x;a=x/s<p/s?s:x/s>p/s?-s:0;b=x%s<p%s?1:x%s>p%s?-1:0;r=x+a;
q+=m[r+b]!=i&&z[r+b]<1?a+b:m[q+b]!=i&&z[q+b]<1?b:m[r]!=i&&z
[r]<1?a:0;if(q==p)h--;else{z[x]=0;z[q]=1;}}}}c.print(p%s,p/
s,"DEAD",1);}}

Another Visit in Hell by Jakub Wasilewski

This is the most I was able to manage in 1024 bytes, and I don’t think I can go any further. Shortening the current version by 80 bytes without removing features would be a small miracle, I think :).

#define F(v,h)for(v=0;v<h;v++)
#define D(i)F(y,S)F(x,T){i;}
#define G d[x][y]
#define M d[x+f][y+g]
#define Z(n)n<0?-1:n?1:0
#define C(v,i)M^v||(i,M=e),
#define r rand()
int x,y,S=23,T=62,c,L,b,k[]=L"$`*$.@`>$]```",f,g,l=18,p=18,w
=1,e=46,v,u=96,K=256,d[90][90],z[90][90];m(f,g){G-64?M-64||(
l-=G-u)>0||(M=e):(M^T||N(),C(u,p+=L)C(42,l=p)C(36,v+=x%9*L+L
)C(93,w=(c=L+r%4)<3?1:c-2)M>u&&(M-=r%w+1)%K<=u&&(M=k[r%5+8])
);M-e?M-35||(g&&m(f,0),f&&m(0,g)):(M=G|K,G=e);}E(t){while(x=
r%T,y=r%S,G-e);G=t;}N(){L++;D(G=35)x=y=9;F(b,S){f=r%58+1;g=r
%21+1;while(f^x||g^y)G=e,r&1?(x+=Z(f-x)):(y+=Z(g-y));}f=0;F(
b,9)L<9&&E(k[b]);F(b,L*2)E(99+r%(L*7/5));}main(){srand(inits
cr());raw();start_color();F(c,8)init_pair(c+1,c,0);N();while
(c-81){D(G-64||(f=x,g=y))D(b=1;while(G^k[b++]&&b<8);F(c,u)d[
f+(x-f)*c/u][g+(y-g)*c/u]-35||(b=z[x][y]<L?1:5);b>6&&G<64&&(
z[x][y]=L);mvaddch(y,x,G|b*K))mvprintw(S,0,"H:%d/%d W:d%d L:
%d $%d %s",l,p,w,L,v,L^9?"":"WIN");c=mvgetch(0,0);D(G>u&&G<K
&&m(Z(f-x),Z(g-y)))D(G-64||m((c-1)%3-1,Z(2+(e-c)/3)))D(G&=25
5)}endwin();}

First 1KBRL Challenge Entries: Fur Hunter

Source CodeFur Hunter
Author: Jakub Debski
Links: Homepage
Language: C++

Slash, a warrior of the XXVIIY Roman Legion, finds an ancient temple during an expedition to the barbarian lands. Decided, he steps into, only to find out it is filled with a horde of angry wolves. Knowing that wolf fur is teh thing in Rome, he tries out his luck by beating different races of evil wolves, down to the 7th level.

Mr. Debski second entry to the 1KBRL Challenge, first submited as a 1.1KB RL and shrinked to the limit thanks to the power of r.g.r.d. It is technically impressive, having implemented a working FOV algorithm, non-trivial enemies with varying strength and random level generation.

Down with da wolves

The challenge there is knowing when to fight and when to run, however excess of healing packs makes things a bit too easy.

Gameplay: A bit repetitive, but playable
Technical Highlights: It has almost everything one can add in 1KB of code, two thumbs up!

First <1KBRL Challenge Entries: LUCK

LUCK
Author: Slash
Links: Minisite, Online Launcher
Language: Java

You find yourself in a dark, dark room. You have no idea why you are here nor how you got here. All you know is that with every step you make, you are getting weaker. Disturbing whispers can be heard everywhere and your only hope of surviving is to push onwards, collecting relics of percentile origin along the way. Suddenly, a horrifying demonic ant… sorry, an *AND* appears before you. You have to make a quick choice: fight it or run for your life…

That’s for the story. Now, for the review.

Slash promised to review *ALL* of the <1kBRLs and I’m here to assure he will never keep his promise by reviewing his creation. First, some technical information. Gameplay takes place on a small, 20×20 map (18×18 playable space), which is more than sufficient. No memory of visited areas is kept, so the PC wanders in the dark, seeing only a diamond-shaped area around him with a radius of 6 tiles. The use of Manhattan distances is logical, since the PC can only move vertically and horizontally. Unfortunately, there is a minor glitch there: when attempting to move diagonally using the numpad, the game exits, so it’s safer to use arrow keys.

The levels contain randomly placed obstacles, a down staircase, a relic and a nasty to make you keep going. No other keystrokes than the arrows are needed, since the PC automatically collects relics and descends stairways upon walking over them. Simplicity rules!

The goal is to collect 10 relics and descend to level 20 before you run out of energy. Simple, huh? Well, not really. The 600 points of energy go down with every move. Additionally, the baddies take away 5 additional energy points if you move next to them. The relics and staircases can be anywhere and you will probably be forced to make long runs before “clearing” a level. Your life is in RNG’s hands, really, which completely justifies the game’s title.

Finally, when you either die or win the game, an appropriate message is shown. Quite a lot for just 1kB of code.

Gameplay: Simple, but fun. Good for those boring moments at work when the boss isn’t around.
Technical Highlights: Many nice features in few bytes of code.

First <1KBRL Challenge Entries: Energon Absorber

Original SourceEnergon Absorber
Author: Numeron
Links: Original Post, Enhanced executable version
Language: Java

All along your childhood you heard legends talk about the legendary big $100 gold coin being held in the third basement of the magic zombie infested wherevers that lie below the town’s chapel. Today, in your 18th birthday, you have decided to retrieve it and prove yourself a man.

As you descend into the unholy depths you notice a Zombie is chasing you around! the worst of your nightmares has come true, and the only way to escape will be recovering all the pieces of the gold key.

 
Found da coin!

In the end, you found the great big gold coin, but what did you win? you just became a Zombie and will chase whoever is fool enough to seek the cursed coin!

Original program used standard java output plus a frame to obtain user input; another dev later replaced IO handling for usage of libjcsi, making it look and feel much better.

This entry stands in the complexity midpoint of the rest of entries; while gameplay is not trivial (ie, you can unwillingly lose the game and there is a goal), it isn’t complex enough to be fun; more levels, obstacles inside them and scoring could have aided.

Gameplay: Unchallenging but existant, not too fun
Technical Highlights: It works as a game!