/*
Interactive Fiction Project
Jennifer A. Nagy
10/16/02
*/

//list of included filew
#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <assert.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>

//list of global variables
char direction;
char input[20];
int create[10]={1,1,1,1,1,1,1,1,1,1};
int i=2;
int j=2;
int map[5][5]={ {2,2,2,2,2},
				{2,1,1,1,2},
				{2,1,1,1,2},
				{2,1,1,1,2},
				{2,2,2,2,2}};

//function declaration
int menu();
void move(char direction);
void go();
void inv();
void start();
void nw();
void n();
void ne();
void w();
void e();
void sw();
void s();
void se();
void tree();
void make();

//Main function which begins the program.  Has basic output and calls
//menu() and start().
void main()
{
cout<<"		********************************\n"
	 <<"		*                              *\n"
	 <<"		*        Junkyard Wars         *\n"
	 <<"		*              by              *\n"
	 <<"		*       Jennifer A. Nagy       *\n"
	 <<"		*                              *\n"
	 <<"		********************************\n\n"
	 <<""<<endl;
getch();
system("cls");

int quit;
quit=menu();

if (quit==1)
 {cout<<"Quit game.  Close window.";}

else if (quit==0)
 {start();}
}

//Menu function provides the main menu for the game.
//It has basic input and output functions and returns an integer
//which is the state of the menu used in main().
int menu()
{
 char option;
 cout<<"Main Menu:\n\n"
	 <<"	(i) introduction\n"
	 <<"	(r) rules\n"
	 <<"	(p) play game\n"
	 <<"	(q) quit game\n"
	 <<"\nEnter Selection:  ";

 cin>>option;

 if (option!='p' && option!='P' && option!='i' && option!='I' &&
	  option!='r' && option!='R' && option!='q' && option!='Q')
  {cout<<"\nCommand not recognized.  Please try again.\n\n"; }

 if (option=='p' || option=='P')
 {	return 0;	}

 if (option=='i' || option=='I')
 { system("cls");
	cout<<"	Welcome to Junkyard Wars!  It is your job to construct an extraordinary\n"
	 <<"machine and pit it against your opponents machine in a challenge to be\n"
	 <<"the best.\n"
	 <<"	Your job is to find the best pieces of junk to build your machine and\n"
	 <<"put those pieces together before time runs out.  Then you must beat the\n"
	 <<"challenge set up for you to test your machine.  This is the engineering\n"
	 <<"equivalent of the Superbowl!\n"
	 <<"	Get ready for excitement and fun playing Junkyard Wars!\n"
	 <<"\nPress enter to return to the menu."
	 <<""<<endl;
	getch();
	system("cls");
 }

 if (option=='r' || option=='R')
 { system("cls");
	cout<<"How to Play:\n"
		 <<"This is a very low tech game.  It understands very few words so you\n"
		 <<"must be specific and make no spelling errors.  Some of the words in\n"
		 <<"the dictionary are as follows:\n"
		 <<"	n	-- causes you to move north\n"
		 <<"	s	-- causes you to move south\n"
		 <<"	e	-- causes you to move east\n"
		 <<"	w	-- causes you to move west\n"
		 <<"	inv	-- shows your inventory\n"
		 <<"	get	-- allows you to put items into inventory\n"
		 <<"	bye	-- quits the game\n"
		 <<"\n"
		 <<"(NOTE: There is plenty of room in your inventory for everything)\n\n"
		 <<"As I stated before, this is a very low tech game.  You are always\n"
		 <<"facing north.  When you move in a direction you will move that way\n"
		 <<"and then turn to face north.  For example, if you move west you can\n"
		 <<"get back the way you came simply by going back east.\n\n"
		 <<"BEWARE! YOU CAN'T SAVE YOUR GAME!"
		 <<"\nPress enter to return to the menu."
		 <<""<<endl;
	getch();
	system("cls");
 }

 if (option=='q' || option=='Q')
  {system("cls");
	return 1;}

 menu();
}

//Move function will take care of your movement.  It is passed the direction
//and will change where you are in the junkyard via a 2D array that holds
//the state of the game.  It calls go().
void move(char direction)
{
 if (direction=='n')
	{
	 i=i-1;
	 if(map[i][j]==2)
		{cout<<"Um, No you can't go that way.\n";
		 return;}
	 else
		go();
	 }
 if (direction=='s')
	{
	 i=i+1;
	 if(map[i][j]==2)
		{cout<<"Um, No you can't go that way.\n";
		 return;}
	 else
		go();
	}
 if (direction=='e')
	{
	 j=j+1;
	 if(map[i][j]==2)
		{cout<<"Um, No you can't go that way.\n";
		 return;}
	 else
		go();
	}
 if (direction=='w')
	{
	 j=j-1;
	 if(map[i][j]==2)
		{cout<<"Um, No you can't go that way.\n";
		 return;}
	 else
		go();
	}

}

//Go function calls the appropriate function for where you move to from
//the direction you have gone.  It is called by move().
void go()
{
 if(i==1)
	{if(j==1)
		nw();
	 if(j==2)
		n();
	 if(j==3)
		ne();
	}
 if(i==2)
	{if(j==1)
		w();
	 if(j==2)
		start();
	 if(j==3)
		e();
	}
 if(i==3)
	{if(j==1)
		sw();
	 if(j==2)
		s();
	 if(j==3)
		se();
	 }

}

//inv function takes care of the inventory.  It is called whenever the user
//types "inv".  It determines what you have by reading the state of the room
//from the 2D array map[][].
void inv()
{system("cls");
 cout<<"You are carrying:"<<endl;

 if(map[1][1]==0 && create[1]==1)
	{cout<<"	tree limb"<<endl;}
 if(map[1][2]==0 && create[0]==1)
	{cout<<"	plaster"<<endl;}
 if(map[1][3]==0)
	{cout<<"	poster paints"<<endl;}
 if(map[2][1]==0)
	{cout<<"	stethescope"<<endl;}
 if(map[2][3]==0 && create[0]==1)
	{cout<<"	paper"<<endl;}
 if(map[3][1]==0 && create[2]==1)
	{cout<<"	plastic raincoat"<<endl;}
 if(map[3][2]==0)
	{cout<<"	knife"<<endl;}
 if(map[3][3]==0)
	{cout<<"	saw"<<endl;}
 if(create[0]==0 && create[2]==1)
	{cout<<"	paper mache"<<endl;}
 if(create[1]==0 && create[2]==1)
	{cout<<"	carved limb"<<endl;}
 if(create[2]==0)
	{cout<<"	umbrella"<<endl;}

 cout<<"\nPress enter to return to game."
	 <<""<<endl;
 getch();
 system("cls");
 return;
}

//start function is the starting point.  It takes care of the game play in
//the center of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void start()
{
i=2;
j=2;
cout<<"\nYou are in a workshop in the center of the junkyard."<<endl;

if(map[i][j]==1)
	cout<<"You see the host of Junkyard Wars."<<endl;

gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{move(direction);}
 else
	{cout<<"What's that supposed to mean?"<<endl;}
}

if(input[0]=='t' && input[1]=='a' && input[2]=='l')
	{
	 cout<<"\nThe thing that you are supposed to make is an umbrella.\n"
		 <<"You have until it starts raining to complete this task.\n"
		 <<"If you think you have all of the pieces, come back here\n"
		 <<"to put them together.  Then tell me when you are done.\n"
		 <<"On your mark...get set...go!"<<endl;}

if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window.  Otherwise, hit enter to continue."<<endl;
	 getch();}

if(	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w')||
	(input[0]=='m' && input[1]=='a' && input[2]=='k' && input[3]=='e')||
	(input[0]=='t' && input[1]=='a' && input[2]=='l'));
else
	{cout<<"I don't think so."<<endl;}

if(input[0]=='m' && input[1]=='a' && input[2]=='k' && input[3]=='e')
	{make();}

start();
}

//nw function is the nw part of the array.  It takes care of the game play in
//the nw part of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void nw()
{
i=1;
j=1;
cout<<"\nYou are at the northeasterern edge of the junkyard.\n"
	<<"You see a large tree with tires piled around it."<<endl;

gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{move(direction);}
 else
	{cout<<"What's that supposed to mean?\n"<<endl;}
}

if(input[0]=='c' && input[1]=='l' && input[2]=='i' && input[3]=='m')
	{tree();}

if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window. Otherwise, hit enter to continue."<<endl;
	 getch();
	 }

if((input[0]=='c' && input[1]=='l' && input[2]=='i' && input[3]=='m')||
	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w'));
else
	{cout<<"I don't think so."<<endl;}
nw();
}

//n function is the n part of the array.  It takes care of the game play in
//the n part of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void n()
{
i=1;
j=2;
cout<<"\nYou are in a pile of stinking refuse.  It really smells here."<<endl;
if(map[i][j]==1)
	cout<<"You see a bag of plaster."<<endl;

gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{move(direction);}
 else
	{cout<<"What's that supposed to mean?\n"<<endl;}
}

if(map[i][j]!=0)
{if(input[0]=='g' && input[1]=='e' && input[2]=='t')
	{cout<<"What do you wish to get?"<<endl;
	 gets(input);
	 if(input[0]=='p' && input[1]=='l' && input[2]=='a')
		 {map[i][j]=0;
		  cout<<"You pick it up and take it with you."<<endl;
			}
	 else
		 cout<<"You don't see that."<<endl;
	}
}

if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window. Otherwise, hit enter to continue."<<endl;
	 getch();}

if((input[0]=='g' && input[1]=='e' && input[2]=='t')||
	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w'));
else
	{cout<<"I don't think so."<<endl;}
n();

}

//ne function is the ne part of the array.  It takes care of the game play in
//the ne part of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void ne()
{
i=1;
j=3;
cout<<"\nYou are on the northeast side of the junkyard.\n"
	<<"The sky looks really blue here."<<endl;
if(map[i][j]==1)
	cout<<"You see nothing of interest here."<<endl;

if(input[0]=='b' && input[1]=='l' && input[2]=='u' && input[3]=='e')
	cout<<"Go blue! You see poster paint."<<endl;

if(map[i][j]!=0)
{if(input[0]=='g' && input[1]=='e' && input[2]=='t')
	{cout<<"What do you wish to get?"<<endl;
	 gets(input);
	 if(input[0]=='p' && input[1]=='a' && input[2]=='i')
		 {map[i][j]=0;
		  cout<<"You pick it up and take it with you."<<endl;
			}
	 else
		 cout<<"You don't see that."<<endl;
	}
}
gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{move(direction);}
 else
	{cout<<"What's that supposed to mean?\n"<<endl;}
}

if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window. Otherwise, hit enter to continue."<<endl;
	 getch();}
if((input[0]=='g' && input[1]=='e' && input[2]=='t')||
	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(input[0]=='b' && input[1]=='l' && input[2]=='u' && input[3]=='e')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w'));
else
	{cout<<"I don't think so."<<endl;}
ne();
}


//w function is the w part of the array.  It takes care of the game play in
//the w part of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void w()
{
i=2;
j=1;
cout<<"\nYou walk into a part of the junkyard where there are tons\n"
	<<"of old rusted cars."<<endl;
if(map[i][j]==1)
	cout<<"You see a stethescope."<<endl;

gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{move(direction);}
 else
	{cout<<"What's that supposed to mean?\n"<<endl;}
}

if(map[i][j]!=0)
{if(input[0]=='g' && input[1]=='e' && input[2]=='t')
	{cout<<"What do you wish to get?"<<endl;
	 gets(input);
	 if(input[0]=='s' && input[1]=='t' && input[2]=='e')
		 {map[i][j]=0;
		  cout<<"You pick it up and take it with you."<<endl;
			}
	 else
		 cout<<"You don't see that."<<endl;
	}
}

if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window. Otherwise, hit enter to continue."<<endl;
	 getch();}
if((input[0]=='g' && input[1]=='e' && input[2]=='t')||
	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w'));
else
	{cout<<"I don't think so."<<endl;}
w();
}

//e function is the e part of the array.  It takes care of the game play in
//the e part of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void e()
{
i=2;
j=3;
cout<<"\nYou feel like you are in a city of old appliances!.\n"
	<<"Appliances of all kinds are stack on top of eachother\n"
	<<"in straight rows like buildings on a city street."<<endl;
if(map[i][j]==1)
	cout<<"You see paper."<<endl;

gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{move(direction);}
 else
	{cout<<"What's that supposed to mean?\n"<<endl;}
}

if(map[i][j]!=0)
{if(input[0]=='g' && input[1]=='e' && input[2]=='t')
	{cout<<"What do you wish to get?"<<endl;
	 gets(input);
	 if(input[0]=='p' && input[1]=='a' && input[2]=='p')
		 {map[i][j]=0;
		  cout<<"You pick it up and take it with you."<<endl;
			}
	 else
		 cout<<"You don't see that."<<endl;
	}
}

if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window. Otherwise, hit enter to continue."<<endl;
	 getch();}

if((input[0]=='g' && input[1]=='e' && input[2]=='t')||
	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w'));
else
	{cout<<"I don't think so."<<endl;}

e();
}

//sw function is the sw part of the array.  It takes care of the game play in
//the sw part of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void sw()
{
i=3;
j=1;
cout<<"\nYou are on the edge of a pond made from rain water which\n"
	<<"collected in a depression on the southwest side of the junkyard.\n"
	<<"Huge piles of clothing make up the shoreline."<<endl;
if(map[i][j]==1)
	cout<<"You see a plastic raincoat."<<endl;

gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{move(direction);}
 else
	{cout<<"What's that supposed to mean?\n"<<endl;}
}

if(map[i][j]!=0)
{if(input[0]=='g' && input[1]=='e' && input[2]=='t')
	{cout<<"What do you wish to get?"<<endl;
	 gets(input);
	 if(input[0]=='r' && input[1]=='a' && input[2]=='i')
		 {map[i][j]=0;
		  cout<<"You pick it up and take it with you."<<endl;
			}
	 else
		 cout<<"You don't see that."<<endl;
	}
}

if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window. Otherwise, hit enter to continue."<<endl;
	 getch();}

if((input[0]=='g' && input[1]=='e' && input[2]=='t')||
	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w'));
else
	{cout<<"I don't think so."<<endl;}

sw();
}

//s function is the s part of the array.  It takes care of the game play in
//the s part of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void s()
{
i=3;
j=2;
cout<<"\nYou are in the southern part of the junkyard."<<endl;
if(map[i][j]==1)
	cout<<"You see a knife."<<endl;

gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{move(direction);}
 else
	{cout<<"What's that supposed to mean?\n"<<endl;}
}

if(map[i][j]!=0)
{if(input[0]=='g' && input[1]=='e' && input[2]=='t')
	{cout<<"What do you wish to get?"<<endl;
	 gets(input);
	 if(input[0]=='k' && input[1]=='n' && input[2]=='i')
		 {map[i][j]=0;
		  cout<<"You pick it up and take it with you."<<endl;
			}
	 else
		 cout<<"You don't see that."<<endl;
	}
}

if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window. Otherwise, hit enter to continue."<<endl;
	 getch();}

if((input[0]=='g' && input[1]=='e' && input[2]=='t')||
	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w'));
else
	{cout<<"I don't think so."<<endl;}
s();
}

//se function is the se part of the array.  It takes care of the game play in
//the se part of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void se()
{
i=3;
j=3;
cout<<"\nYou have found the cast off furniture in the junkyard.\n"
	<<"This furniture is old and weathered from spending many days here."<<endl;
if(map[i][j]==1)
	cout<<"You see a saw."<<endl;

gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{move(direction);}
 else
	{cout<<"What's that supposed to mean?\n"<<endl;}
}

if(map[i][j]!=0)
{if(input[0]=='g' && input[1]=='e' && input[2]=='t')
	{cout<<"What do you wish to get?"<<endl;
	 gets(input);
	 if(input[0]=='s' && input[1]=='a' && input[2]=='w')
		 {map[i][j]=0;
		  cout<<"You pick it up and take it with you."<<endl;
			}
	 else
		 cout<<"You don't see that."<<endl;
	}
}

if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window. Otherwise, hit enter to continue."<<endl;
	 getch();}

if((input[0]=='g' && input[1]=='e' && input[2]=='t')||
	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w'));
else
	{cout<<"I don't think so."<<endl;}

se();
}

//tree function is above the nw part of the array.  However, the state
//is held in the nw part of the array.  It takes care of the game play in
//the tree of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void tree()
{
cout<<"\nYou are at the top of the tree."<<endl;
if(map[i][j]==1)
	cout<<"You see a long, straight tree limb."<<endl;

gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{cout<<"When pigs fly..."<<endl;}
 else
	{cout<<"What's that supposed to mean?\n"<<endl;}
}

if(map[i][j]!=0)
{if(input[0]=='c' && input[1]=='u' && input[2]=='t')
	{cout<<"What do you wish to cut the tree limb with?"<<endl;
	 gets(input);
	 if(input[0]=='s' && input[1]=='a' && input[2]=='w')
		 {if(map[3][3]==0)
			{map[i][j]=0;
			cout<<"You use the saw to cut off the tree limb.\n"
			<<"You pick it up and take it with you."<<endl;}
			}
	 else
		 cout<<"You don't have a saw."<<endl;
	}
}
if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window. Otherwise, hit enter to continue."<<endl;
	 getch();}

if(input[0]=='c' && input[1]=='l' && input[2]=='i' && input[3]=='m')
	{cout<<"You have climbed down the tree"<<endl;
	 nw();}

if((input[0]=='c' && input[1]=='l' && input[2]=='i' && input[3]=='m')||
	(input[0]=='c' && input[1]=='u' && input[2]=='t')||
	(input[0]=='s' && input[1]=='a' && input[2]=='w')||
	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w'));
else
	{cout<<"I don't think so."<<endl;}
tree();

}

//make function is above the center part of the array.  However, the state
//is held in the center part of the array.  It takes care of the game play in
//the make part of the map array.  It calls inv() and move() and will
//recursively call itself until it has called move().
void make()
{
cout<<"\nYou are at your workbench in the center of the junkyard.\n"
	<<"What item in your inventory do you wish to use?\n"
	<<"If you wish to leave the workbench just choose a direction."<<endl;

gets(input);

if(input[1]=='\0')
{direction=input[0];
 if(direction=='n' || direction=='s' || direction=='e' || direction=='w')
	{move(direction);}
 else
	{cout<<"What's that supposed to mean?\n"<<endl;}
}

if(input[0]=='l' && input[1]=='i' && input[2]=='m' && input[3]=='b')
{if(create[0]!=0 && map[1][1]==0)
	{	cout<<"\nWhat item in your inventory do you wish to use with it?"<<endl;
		gets(input);
		if(input[0]=='k' && input[1]=='n' && input[2]=='i')
			{if(map[3][2]==0)
				{map[i][j]=0;
				cout<<"\nYou use the knife to shape the tree limb."<<endl;
				create[0]=0;
				}
			 else
				cout<<"You don't have a knife."<<endl;
			}
	}
 else
	cout<<"You don't have a limb."<<endl;
}

if(input[0]=='p' && input[1]=='l' && input[2]=='a' && input[3]=='s')
{if(create[1]!=0 && map[1][2]==0)
	{	cout<<"\nWhat item in your inventory do you wish to use with it?"<<endl;
		gets(input);
		if(input[0]=='p' && input[1]=='a' && input[2]=='p')
			{if(map[2][3]==0)
				{map[i][j]=0;
				cout<<"\nYou mix the plaster and paper together to create paper mache.\n"
					<<"You spread this out onto a large curved bowl to create a large,\n"
					<<"umbrella like, half sphere."<<endl;
				create[1]=0;
				}
			 else
				cout<<"You don't have paper."<<endl;
			}
	}
 else
	 cout<<"You don't have plaster."<<endl;
}

if(create[0]==0 && create[1]==0 && map[3][1]==0)
	{	cout<<"\nYou plaster the paper mache umbrella to the tree limb.\n"
			<<"You then wrap the raincoat over the paper mache.\n"
			<<"You have created an umbrella!"<<endl;
		create[2]=0;
	}
 else
	 cout<<"\nYou don't have everything you need to create the umbrella yet."<<endl;


if(input[0]=='i' && input[1]=='n' && input[2]=='v')
	{inv();}

if(input[0]=='b' && input[1]=='y' && input[2]=='e')
	{system("cls");
	 cout<<"To quit game, close window. Otherwise, hit enter to continue."<<endl;
	 getch();}

if(	(input[0]=='i' && input[1]=='n' && input[2]=='v')||
	(input[0]=='b' && input[1]=='y' && input[2]=='e')||
	(input[0]=='l' && input[1]=='i' && input[2]=='m' && input[3]=='b')||
	(input[0]=='k' && input[1]=='n' && input[2]=='i')||
	(input[0]=='p' && input[1]=='l' && input[2]=='a' && input[3]=='s')||
	(input[0]=='p' && input[1]=='a' && input[2]=='p')||
	(direction=='n' || direction=='s' || direction=='e' || direction=='w'));
else
	{cout<<"I don't think so."<<endl;}

if(create[2]==0 && map[1][3]==0)
	{cout<<"\n\nYou paint the umbrella with yellow and blue poster paints.\n"
		 <<"The host, being a fan of the wolverines, decides to default\n"
		 <<"the challenge to you!\n"
		 <<"You have won!"<<endl;
	 getch();
	 system("cls");
	 cout<<"To quit game, close window."<<endl;
	 getch();
	}
else if(create[2]==0 && map[1][3]==1)
	{cout<<"\n\nYou give the umbrella to the host just as it starts raining!\n"
		 <<"The host looks at your umbrella, then looks at your opponents\n"
		 <<"umbrella.  Being a fan of the wolverines, the host decides to\n"
		 <<"default the challenge to the other team which painted their\n"
		 <<"umbrella yellow and blue!\n"
		 <<"You have lost!"<<endl;
	 getch();
	 system("cls");
	 cout<<"To quit game, close window."<<endl;
	 getch();
	}
make();

}