Hello forum. I have a question.
I have something like this written:
transportation(miami, plane).
transportation(toronto, car).
transportation(utah, plane).
transportation(newyork, car).
transportation(england, boat).
transportation(india, boat).
price(miami, 500.00).
price(toronto, 300.00).
price(utah, 600.00).
price(newyork, 400.00).
price(england, 900.00).
price(india, 1500.00).
and I want the user to type their preference of travel (plane, car, boat), so that the system could give them the possible destinations to choose from. Note that I ask the user multiple questions consequently and i don't want them to press space bar in order to show all the possible destinations.
write("What mean of transportation will you wish to use? (options: plane, car, boat)"),nl,
read(InputT),nl,
transportation(OutputT,InputT),nl,
write(OutputT),nl,
write("What's your badget?"),nl,
read(InputP),nl,
price(OutputP, InputP),nl,
write(OutputP),nl.
it runs smoothly but the output is only the first of each category (when user selects plane, it is always and only miami etc.)
I would like the system 1) to find all the available destinations
2) store them somewhere in order to proceed to the next question (this time with some filter from the previous question. For example if the user types car I want the system to show only Toronto and NewYork and then when it comes to the next question about pricing , I want the system to only process the question for the destinations with car.
Im new to prolog don't hate me if it's too simple. Thanks forum, cheers.