/**
* @3rd Annual Bahamas Pelletier School Food-a-thon and Gaming Session
* @programmer Dököll
* @version 2007.12.9
*/
[CODE=JAVA]
public class Game
{
private Parser parser;
private Room currentRoom;
private Food currentFood;
private Eat currentEat;
private View currentView;
/**
* Print out the opening message for the player.
* This can be used ofr user instructions
*/
private void printWelcome()
{
System.out.prin tln();
System.out.prin tln("Welcome to the 3rd Annual Bahamas Pelletier School Food-a-thon and Gaming Session!");
System.out.prin tln("The Bahamas Pelletier School Food-a-thon proudly presents FREE food for all after the game.");
System.out.prin tln("You have 4 options in this game. Please do one option at a time.");
System.out.prin tln("First option deals with areas of a certain school establishment." );
System.out.prin tln("After looking aroung the establishment, take a look in the lounge refrigerator for treats.");
System.out.prin tln("Take a closer view of the types of food inlcuded in this now, wonderful fridge of yours.");
System.out.prin tln("Be sure to make use of the free food, then you can go home. How's that for a deal?.");
System.out.prin tln();
System.out.prin tln("Your key verbs are 'go' for first option, 'look' for second, 'view' for third," + "\n" + "and 'eat' for last option in the game");
System.out.prin tln();
System.out.prin tln("Type 'help' if you need help.");
System.out.prin tln("Type 'quit' if you need to end the game.");
System.out.prin tln();
System.out.prin tln("Let us begin!");
System.out.prin tln();
System.out.prin tln("You can type 'go' then the posted Exit to visit the school establishment." + "\n" + currentRoom.get LongDescription ());
System.out.prin tln();
System.out.prin tln("Now, type 'look' then the posted Exit to have a look around." + "\n" + currentFood.get LongDescription ());
System.out.prin tln();
System.out.prin tln("Type 'view' then the posted Exit to look inside the fridge." + "\n" + currentView.get LongDescription ());
System.out.prin tln();
System.out.prin tln("Now that you've seen it all, type 'eat' then the posted Exit to have fun with free meals." + "\n" + currentEat.getL ongDescription( ));
}
/**
* Create the game and initialise its internal map.
* Create 4 items for the game, 4 different classes.
*/
public Game()
{
createRooms();
createFoods();
createEats();
createViews();
parser = new Parser();
}
/**
* Create all the rooms and link their exits together.
* Create specific subclasses for each item in each class.
*/
private void createRooms()
{
Room outside, theatre, pub, lab, office, dorm;
// create the rooms
outside = new Room("outside of the theatre and looking at a 1300 penny");
theatre = new Room("given free concert tickets and invited to a rare event with friends");
pub = new Room("in a local pub and having the soda pop of the year");
lab = new Room("saving this mouse from the lab");
office = new Room("in your office and you're not allowed to take paper clips");
dorm = new Room("outside your dorm and has been awarded with a purple candy bar");
// initialise room exits
outside.setExit ("west", theatre);
theatre.setExit ("north", pub);
pub.setExit("ea st", lab);
lab.setExit("so uth", dorm);
office.setExit( "north", office);
dorm.setExit("w est", outside);
currentRoom = lab; // start game in the lab
}
[/CODE]
Code continues in next page...
* @3rd Annual Bahamas Pelletier School Food-a-thon and Gaming Session
* @programmer Dököll
* @version 2007.12.9
*/
[CODE=JAVA]
public class Game
{
private Parser parser;
private Room currentRoom;
private Food currentFood;
private Eat currentEat;
private View currentView;
/**
* Print out the opening message for the player.
* This can be used ofr user instructions
*/
private void printWelcome()
{
System.out.prin tln();
System.out.prin tln("Welcome to the 3rd Annual Bahamas Pelletier School Food-a-thon and Gaming Session!");
System.out.prin tln("The Bahamas Pelletier School Food-a-thon proudly presents FREE food for all after the game.");
System.out.prin tln("You have 4 options in this game. Please do one option at a time.");
System.out.prin tln("First option deals with areas of a certain school establishment." );
System.out.prin tln("After looking aroung the establishment, take a look in the lounge refrigerator for treats.");
System.out.prin tln("Take a closer view of the types of food inlcuded in this now, wonderful fridge of yours.");
System.out.prin tln("Be sure to make use of the free food, then you can go home. How's that for a deal?.");
System.out.prin tln();
System.out.prin tln("Your key verbs are 'go' for first option, 'look' for second, 'view' for third," + "\n" + "and 'eat' for last option in the game");
System.out.prin tln();
System.out.prin tln("Type 'help' if you need help.");
System.out.prin tln("Type 'quit' if you need to end the game.");
System.out.prin tln();
System.out.prin tln("Let us begin!");
System.out.prin tln();
System.out.prin tln("You can type 'go' then the posted Exit to visit the school establishment." + "\n" + currentRoom.get LongDescription ());
System.out.prin tln();
System.out.prin tln("Now, type 'look' then the posted Exit to have a look around." + "\n" + currentFood.get LongDescription ());
System.out.prin tln();
System.out.prin tln("Type 'view' then the posted Exit to look inside the fridge." + "\n" + currentView.get LongDescription ());
System.out.prin tln();
System.out.prin tln("Now that you've seen it all, type 'eat' then the posted Exit to have fun with free meals." + "\n" + currentEat.getL ongDescription( ));
}
/**
* Create the game and initialise its internal map.
* Create 4 items for the game, 4 different classes.
*/
public Game()
{
createRooms();
createFoods();
createEats();
createViews();
parser = new Parser();
}
/**
* Create all the rooms and link their exits together.
* Create specific subclasses for each item in each class.
*/
private void createRooms()
{
Room outside, theatre, pub, lab, office, dorm;
// create the rooms
outside = new Room("outside of the theatre and looking at a 1300 penny");
theatre = new Room("given free concert tickets and invited to a rare event with friends");
pub = new Room("in a local pub and having the soda pop of the year");
lab = new Room("saving this mouse from the lab");
office = new Room("in your office and you're not allowed to take paper clips");
dorm = new Room("outside your dorm and has been awarded with a purple candy bar");
// initialise room exits
outside.setExit ("west", theatre);
theatre.setExit ("north", pub);
pub.setExit("ea st", lab);
lab.setExit("so uth", dorm);
office.setExit( "north", office);
dorm.setExit("w est", outside);
currentRoom = lab; // start game in the lab
}
[/CODE]
Code continues in next page...
Comment