service { const html Intro =
The fate of the world lies in your hands, please find that key
and save us....you have two weeks (ie 14 chances) before we all rot in
Microsoft hell....
Your are currently in the middle of McGill...where do you want to go?
Go straight one step
Go left one step
Go right one step
Go back one step
;
const html Prompt1 =
Go straight one step
Go left one step
Go right one step
Go back one step
;
const html Found =
Digging into the ground for it....a key appears!
This is the golden key! Congratulations....you have saved
this world from Microsoft domination....
You are now famous.....everyone loves you.....you are more
popular than god himself....
Thank you for playing this god aweful game....cya soon!;
const html NotFound =
GAME OVER!
;
const html ReachBounds =
Please pick another direction to go....
Go straight one step
Go left one step
Go right one step
Go back one step
;
schema Position { //using tuples for x,y coordinates....
int x;
int y;
}
int seed1,seed2;
int day;
session begin() { //get seed numbers from birthday
show Intro receive[seed1 = year,seed2 = month,day=day];
exit Bye;
}
session StartPlay() { //start the game session
tuple Position p;
int num1,num2; //x, y coordinate of key
int max; //max
int i,limit;
string dir; //direction
limit = 14; //max limit of guesses
num1 = ((12233 * seed1 + 132) % 65536) % 4;//generate x and y coordinates
num2 = ((11233 * seed2 + 102) % 65536) % 4;
if (day > 0 && day < 8) //generates whether x,y positive or negative
num1 = num1 * -1;
if (day >= 8 && day < 16)
num2 = num2 * -1;
if (day > 15 && day < 23) {
num1 = num1 * -1;
num2 = num2 * -1;
}
show StartMsg receive[dir=dir]; //show start, user picks direction
p = tuple { x=0, y=0 }; //origin
max = 3; //bounds
i = 0; //increment
while (i < limit) { //direction user wants to go
if (dir == "left")
p.x = p.x - 1;
if (dir == "right")
p.x = p.x + 1;
if (dir == "up")
p.y = p.y + 1;
if (dir == "down")
p.y = p.y - 1;
if (p.x == num1 && p.y == num2) //if position matches key coordinates, user wins
exit Found;
else
show plug Prompt1[xpos=p.x,ypos=p.y] receive[dir=dir]; //show where they, try again
if (p.x == max && dir == "right") //tell user they reached the bounds
show ReachBounds receive[dir=dir];
if (p.x == (max * -1) && dir == "left")
show ReachBounds receive[dir=dir];
if (p.y == max && dir == "up")
show ReachBounds receive[dir=dir];
if (p.y == (max * -1) && dir == "down")
show ReachBounds receive[dir=dir];
i = i + 1;
}
exit NotFound; //if over limit of tries, then player loses
}
}