April 25, 2024, 09:27:23 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


StevenP's first App

Started by Steven Picard, November 05, 2005, 01:38:06 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Steven Picard

November 05, 2005, 01:38:06 PM Last Edit: November 05, 2005, 02:30:43 PM by stevenp
Here is my first app.  I did a loose translation of my 1k entry on the other forum.  I was going to see how small I could get the source code compared to my entry but I think I'll wait until the language is further along for that.

It's kind of a stupid game but it was aimed being 1k (when obfuscated by taking out every unnecessary line break, space, etc..)  I made a few modifications but all-in-all it was good for learning the basic syntax of Aurora.

In the game you need to find the door and exit the random map. Before you can do that you must find the key to unlock the door.  Before you can do that you must find $4 in gold.

Be Kind!  ;D It's a dumb program but was originally a 1k example and my first effort at Aurora.

CONST GOLDCOUNT = 4;
CONST MAP_SIZE = 9;
CONST TURNS = 200;

byte g[9,9],c[9,9];
int r,n,a,z,x,y,q,k,m,s;

global sub main()
{
int j,i;
string d$;

r=rand(0,MAP_SIZE);n=rand(0,MAP_SIZE);a=rand(0,MAP_SIZE);
z=rand(0,MAP_SIZE);x=rand(0,MAP_SIZE);y=rand(0,MAP_SIZE);
q=0;k=0;m=0;s=0;

for (i=0;i<(MAP_SIZE+1);i++)
{
for (i=0;i<(MAP_SIZE+1);i++)
{
g[i,j]=rand(0,9);
c[i,j]=rand(0,9);
}
}

Display();

do
{
writeln("> ");
d = ReadLn();
d = LCase$(d);
if (d="n" & y > 0) {y--;}
if (d="s" & y < MAP_SIZE) {y++;}
if (d="e" & x > 0) {x--;}
if (d="w" & x < MAP_SIZE) {x++;}
Display();
} until q=1;

WaitKey();
return 0;
}

sub Display()
{
def p[10] as string; int loc;
p[0]="CLEARING";p[1]="HILL";
p[2]="GARDEN";p[3]="SMALL HILL";
p[4]="PATH";p[5]="TWISTY PATH";
p[6]="FORST";p[7]="BUSHES";
p[8]="THICK FOREST";p[9]="POND";

CLS();

loc = g[x,y];
writeln("LOCATION: "+p[loc]+"\n");
e="";

IF (y > 0) e="N ";
IF (y < MAP_SIZE) e+=" S ";
IF (x > 0) e+=" E ";
IF (x < MAP_SIZE) e+=" W ";

writeln( "EXITS: "+e+"\n");

if m=TURNS {
q=1;
writeln( "YOU LOSE!\n");
}

if (x=r&y=n&k=0&s> 3){
writeln( "A KEY!\n");
k=1;
}

if (x=r&y=n&k=0&s < GOLDCOUNT) {
writeln(using("YOU NEED $## FOR THE KEY!\n",GOLDCOUNT));
}

if (x=a&y=z&k= 0) {
writeln( "LOCKED DOOR\n");
}
else {
if (x=a&y=z) {
writeln( "DOOR'S OPENED! YOU WIN!\n");
q=1;
}
}
if (c[x,y]= 4) {
s++;
c[x,y]=0;
writeln( "GOLD!\n");
}
writeln("MONEY $"+str$(s)+"\n");
m++;
writeln(using("TURNS LEFT:###",(TURNS-m))+"\n");
return 0;
}

sub WaitKey()
{
while (GetKey()="");
return 0;
}