menu:-message.

region(afar,amhara,'benishangul gumuz',gambela,harari,oromiya,somali,snnp,tigray).

%travel(region1,region2,region3,region4,region5,region6,region7,region8,region9).
%tour(cityName,season,description,Travel_cost,hotelReservation,distance,contactInformation,tour_type,traveAgency,path)

%tour('Dahir Dar',amhara,'all season','found at the middle of lake tana and abay',200,'summer land,ethio star',570,'travel agencies','Natural Land Escapes','Lake Tana, River Abay','NTO','Debre markos').
tour('Dahir Dar',amhara,winter,'found at the middle of lake tana and abay',200,'summer land',570,'travel agencies','Natural Land Escapes','Lake Tana','NTO','Debre markos').
tour('Dahir Dar',amhara,winter,'found at the middle of lake tana and abay',200,'summer land',570,'travel agencies','Natural Land Escapes','River Abay','NTO','Debre markos').
tour('Dahir Dar',amhara,winter,'found at the middle of lake tana and abay',200,'ethio star',570,'travel agencies','Natural Land Escapes','Lake Tana','NTO','Debre markos').
tour('Dahir Dar',amhara,winter,'found at the middle of lake tana and abay',200,'ethio star',570,'travel agencies','Natural Land Escapes','River Abay','NTO','Debre markos').

reservation('Bahir Dar','Summer Land',amhara).
reservation('Bahir Dar','Ethio Star',amhara).
reservation('Bahir Dar','Papyrus',amhara).
reservation('Gondar','Gondar Hotel',amhara).



citys('Bahir Dar','River Abay','Natural Land escape',amhara).
citys('Bahir Dar','Lake Tana','Natural Land escape',amhara).
citys('Gondar','Fasil Castle','Historic sight',amhara).
citys('Mekele','Atse Yohannis Castle','Historic sight',tigray).
%cost wise searching. 
cost(bahir_dar,100,lake_tana).
cost(bahir_dar,100,river_abay).
cost(gondar,500,fasil).
cost(mekele,1000,atse_Yohannis_Castle ).
%distance wise searching.
neareset(bahir_dar,570,lake_tana).
neareset(bahir_dar,570,river_abay).
neareset(gondar,750,fasil).
neareset(mekele,785,atse_Yohannis_Castle).

%toursite(A,B):-citys('Bahir Dar','River Abay',_,_).
toursite(A,B):-citys(A,B,_,_).
cityreservation(A,B):-reservation(A,B,_).

%cityR1(Bahir Dar,Gondar,Markos,).

message:-write('==================================================='),nl,
         write('=====   TOUR & TRAVEL GUIDE EXPERT SYSTEM    ======'),nl,
	     write('=====  GROUP MEMBERS                         ======'),nl,
		 write('=====   BEKELE HAILE ID No: 069/2000         ======'),nl,
		 write('=====   DAWIT ABRHA  ID No: 103/2000         ======'),nl,
		 write('=====   DAWIT ANEGAGRIE  ID No: 105/2000     ======'),nl,
	     write('=====            Enter go.                   ======'),nl,
	     write('==================================================='),nl,nl,
	  write('*******************************************************************************************'),nl,
      write('*******************************************************************************************'),nl,
	  write('***********                                                                     ***********'),nl,
	  write('***********             TOUR & TRAVEL GUIDE EXPERT SYSTEM                       ***********'),nl,
	  write('***********                                                                     ***********'),nl,
	  write('*******************************************************************************************'),nl,
	  write('*******************************************************************************************'),nl.
:-message.
go:-  write('Enter 1 to search by region. '),nl,
      write('Enter 2 to search by city. '),nl,
	  write('Enter 3 to search the nearest city to Addis Ababa. '),nl,
	  write('Enter 4 to search the city with the minimum travel cost. '),nl,
      write('Enter 5 by sight type(Cultural, museum, historic places, parks). '),nl,
	  write('Enter 6 to add knowledge. '),nl,
      read(R), choice(R).


choice(1):- write('Enter 1 to display available regions. '),nl,
			write('Enter 2 to display all the cities available in a region. '),nl,
			%write('Enter 3 to display tour sights available in a region. '),nl,
			write('Enter 3 to display reservations available in a region. '),nl,
			read(R1), choice1(R1).
choice1(1):-region(X1,X2,X3,X4,X5,X6,X7,X8,X9),write('The available regions with tour sites are:'),nl,write(X1),nl,
            write(X2),nl,write(X3),nl,write(X4),nl,write(X5),nl,write(X6),nl,write(X7),nl,write(X8),nl,write(X9),nl,nl.

   cs(X,Z):-	citys(X,_,_,Z).		
choice1(2):-write('Enter the region name:'),nl,read(R),nl,
			write('The cities available in '),write(R),write(' region is/are:'),(R=Z,cs(X,Z),nl,write(X),nl,fail,nl),nl.
			
						
choice1(3):-write('Enter the region name:'),nl,read(R),nl,
			write('Hotels and Reservations available in:'),write(R),write(' are:'),(R=Z,reservation(X,Y,Z),nl,nl,write('****************************'),nl,
			write(X),nl,write(Y),nl,fail,nl),nl.
			%choice1(3):-!,write('Input Error !!').	   
	  


choice(2):-write('Enter 1 to display all available cities. '),nl,
		   write('Enter 2 to display all the cities with available information. '),nl,
	       write('Enter 3 to display tour sights available in a city. '),nl,
		   write('Enter 4 to display reservations available in a city. '),nl,
	       read(R2), choice2(R2).
 cit(X):-citys(X,_,_,_).
 choice2(1):-write('The cities available with tour site are:'),nl,cit(X),write(X),nl,fail,nl.
  
%tour('Dahir Dar',amhara,winter,'found at the middle of lake tana and abay',200,'summer land,ethio star','570','travel agencies','Natural Land Escapes','Lake Tana, River Abay','NTO','Debre markos').
 choice2(2):-write('The cities available are:'),tour(A,B,C,D,E,F,G,H,I,J,K,L),(B=amhara),nl,nl,
             write('**********************************************************************************************'),nl,
			 write('City name: '),write(A),write('     '),write('Region: '),write(B),write('     '),write('Season: '),write(C),write('     '),nl,
			 write('Description: '),write(D),write('     '),write('Travel cost: '),write(E),write('     '),write('Hotels and Reservations: '),write(F),write('     '),nl,
			 write('Distance: '),write(G),write('     '),write('Contact Information: '),write(H),write('     '),write('Tour type: '),write(I),write('     '),nl,
			 write('Tour sight: '),write(J),write('     '),write('Travel agency: '),write(K),write('     '),write('City through: '),write(L),nl,fail,nl,nl.			 
 
 
 choice2(3):-write('Enter city name '),nl,read(R),nl,write('The tour site/s in '),write(R),write(' city is/are'),
			(R=A,toursite(A,B),nl,nl,write('****************************'),nl,write(B),nl,fail,nl),nl.
 
 
 choice2(4):-write('Enter city name '),nl,read(R),nl,write('The reservation/s in '),write(R),write(' city is/are'),
			(R=A,cityreservation(A,B),nl,nl,write('****************************'),nl,write(B),nl,fail,nl),nl.

% nearest city			
choice(3):-maxir(N1),searchmaxir(N1).
maxir(N1):- neareset(X,N1,_),not(lend(X)),!.
lend(X):- neareset(X,N,_), neareset(_,M,_),M <N.
searchmaxir(Ir):-neareset(A,Ir,B),nl,
	                     write('Location= '),write(B),
			     write(' City  = '),write(A), tab(1),write('.....'),write(Ir),tab(1),write('Km'),fail,nl.

% minimum cost
choice(4):-minlr(N1),searchnl(N1).
minlr(N1):- cost(X,N1,_),not(lend(X)),!.
lend(X):- cost(X,N,_), cost(_,M,_),M <N.
searchnl(Ir):-cost(A,Ir,B),nl,
	                     write('Location= '),write(B),
			     write(' City  = '),write(A), tab(1),write('.....'),write(Ir),tab(1),write('Birr'),fail,nl.
choice(5):-write('Enter 1 to display all historical tour sites. '),nl,
		    write('Enter 2 to display all holiday celebration tour sites. '),nl,
	        write('Enter 3 to display all museum tour sites. '),nl,
		    write('Enter 4 to display sanctuaries and parks tour sites. '),nl,
			write('Enter 5 to display all natural land escape tour sites. '),nl,
	        read(R5), choice5(R5).
%tour('Dahir Dar',amhara,winter,'found at the middle of lake tana and abay',200,'summer land',570,'travel agencies','Natural Land Escapes','Lake Tana','NTO','Debre markos').

  toursiteType1(A,B,C,D,E,F,G,H,I,J,K):-tour(A,B,C,D,E,F,G,H,'Historic site',I,J,K).
  toursiteType2(A,B,C,D,E,F,G,H,I,J,K):-tour(A,B,C,D,E,F,G,H,'Holiday celebration',I,J,K).
  toursiteType3(A,B,C,D,E,F,G,H,I,J,K):-tour(A,B,C,D,E,F,G,H,'Museum',I,J,K).
  toursiteType4(A,B,C,D,E,F,G,H,I,J,K):-tour(A,B,C,D,E,F,G,H,'Sanctuaries and Parks',I,J,K).
  toursiteType5(A,B,C,D,E,F,G,H,I,J,K):-tour(A,B,C,D,E,F,G,H,'Natural Land Escapes',I,J,K).
  
 choice5(1):-toursiteType1(A,B,C,D,E,F,G,H,I,J,K),write('**********************************************************************************************'),nl,
			 write('City name: '),write(A),write('     '),write('Region: '),write(B),write('     '),write('Season: '),write(C),write('     '),nl,
			 write('Description: '),write(D),write('     '),write('Travel cost: '),write(E),write('     '),write('Hotels and Reservations: '),write(F),write('     '),nl,
			 write('Distance: '),write(G),write('     '),write('Contact Information: '),write(H),write('     '),nl,
			 write('Tour sight: '),write(I),write('     '),write('Travel agency: '),write(J),write('     '),write('City through: '),write(K),nl,fail,nl,nl.
			 
 choice5(2):-toursiteType2(A,B,C,D,E,F,G,H,I,J,K),write('**********************************************************************************************'),nl,
			 write('City name: '),write(A),write('     '),write('Region: '),write(B),write('     '),write('Season: '),write(C),write('     '),nl,
			 write('Description: '),write(D),write('     '),write('Travel cost: '),write(E),write('     '),write('Hotels and Reservations: '),write(F),write('     '),nl,
			 write('Distance: '),write(G),write('     '),write('Contact Information: '),write(H),write('     '),nl,
			 write('Tour sight: '),write(I),write('     '),write('Travel agency: '),write(J),write('     '),write('City through: '),write(K),nl,fail,nl,nl.
			 
 choice5(3):-toursiteType3(A,B,C,D,E,F,G,H,I,J,K),write('**********************************************************************************************'),nl,
			 write('City name: '),write(A),write('     '),write('Region: '),write(B),write('     '),write('Season: '),write(C),write('     '),nl,
			 write('Description: '),write(D),write('     '),write('Travel cost: '),write(E),write('     '),write('Hotels and Reservations: '),write(F),write('     '),nl,
			 write('Distance: '),write(G),write('     '),write('Contact Information: '),write(H),write('     '),nl,
			 write('Tour sight: '),write(I),write('     '),write('Travel agency: '),write(J),write('     '),write('City through: '),write(K),nl,fail,nl,nl.
			 
 choice5(4):-toursiteType4(A,B,C,D,E,F,G,H,I,J,K),write('**********************************************************************************************'),nl,
			 write('City name: '),write(A),write('     '),write('Region: '),write(B),write('     '),write('Season: '),write(C),write('     '),nl,
			 write('Description: '),write(D),write('     '),write('Travel cost: '),write(E),write('     '),write('Hotels and Reservations: '),write(F),write('     '),nl,
			 write('Distance: '),write(G),write('     '),write('Contact Information: '),write(H),write('     '),nl,
			 write('Tour sight: '),write(I),write('     '),write('Travel agency: '),write(J),write('     '),write('City through: '),write(K),nl,fail,nl,nl.

 choice5(5):-toursiteType5(A,B,C,D,E,F,G,H,I,J,K),write('**********************************************************************************************'),nl,
			 write('City name: '),write(A),write('     '),write('Region: '),write(B),write('     '),write('Season: '),write(C),write('     '),nl,
			 write('Description: '),write(D),write('     '),write('Travel cost: '),write(E),write('     '),write('Hotels and Reservations: '),write(F),write('     '),nl,
			 write('Distance: '),write(G),write('     '),write('Contact Information: '),write(H),write('     '),nl,
			 write('Tour sight: '),write(I),write('     '),write('Travel agency: '),write(J),write('     '),write('City through: '),write(K),nl,fail,nl,nl.


choice(6):-write('Enter the knowledege here. '),nl,read(T),inputTextFile('proj.pl',T),nl,write('Knowledge successfully entered').

inputTextFile(F,T):-
	
	append(F),nl,  
	write(T),         
	told.   




		%cityInfo:-citys(X,Y,Z),tour(_,A,B,C,D,E,_,F,G,H),write('The cities available are:'),nl. 

%city:-citys(X),write('The cities available are:').




% HERE ARE THE NEWLY ADDED KNOWLEDGES.
