import VGP.*;
import java.io.*;

public class game
	{
	public static void main(String[] args) throws Exception
		{
		World Swiat = new World();
		Swiat.Locations[0].SetName("Living room");
		Swiat.Locations[0].AddNPC("Jachu","He");
		Swiat.Locations[0].AddNPC("Rychu","He");
		Swiat.Locations[0].AddNPC("Wiesia","She");
		Swiat.Locations[0].AddObject("Computer");
		Swiat.Locations[0].AddObject("Vodka");
		Swiat.Locations[0].AddObject("Hi-Fi");
		do	{
	  		int x = 0;
			System.out.printf("You are in "+Swiat.Locations[0].GetName()+". There are:");
			do {
			   System.out.printf(Swiat.Locations[0].LocationNPCs[x].GetName()+", ");
			   x++;
			   }
			while(x<Swiat.Locations[0].LocationNPCs.length);
			x = 0;
			do {
			   System.out.printf(Swiat.Locations[0].LocationObjects[x].GetName());
			   if(x==Swiat.Locations[0].LocationObjects.length-2) System.out.printf(" and ");
			   else if(x!=Swiat.Locations[0].LocationObjects.length-1) System.out.printf(", ");
			   x++;
			   }
			while(x<Swiat.Locations[0].LocationObjects.length);
			System.out.printf(". You have to kill someone. Whitch one do you kill?\n");
			String sBuff = new String();
			try {
			    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
			    sBuff = bf.readLine();
			    }
			catch (IOException ioe)
				{
				throw new Exception("Couldn't read");
				}
			try{
			    int npcid = Swiat.Locations[0].GetNPCID(sBuff);
			    System.out.printf("You have killed "+Swiat.Locations[0].LocationNPCs[npcid].GetName()+". Accidentaly "+Swiat.Locations[0].LocationNPCs[npcid].GetGender().toLowerCase()+" have destroyed "+Swiat.Locations[0].LocationObjects[npcid].GetName()+".\n \n \n"); 
			    Swiat.Locations[0].DeleteNPC(npcid);
			    Swiat.Locations[0].DeleteObject(npcid);
			    }
			catch (Exception ngf)
				{
				if(sBuff.compareTo("")!=0) System.out.printf("There isn't any guy called "+sBuff+"! \n \n");
				}
			}
		while(Swiat.Locations[0].LocationNPCs[0].GetName()!="RNULL");
		}
	}