Skip to content

Commit

Permalink
Added new feature for travellers
Browse files Browse the repository at this point in the history
  • Loading branch information
cherylchen2 committed Feb 16, 2020
1 parent 31f900e commit 03947a7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
14 changes: 8 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#Get user input
userSimInput = input("Simulate in home country or outside of home country?")
if userSimInput == "In":
user = userpref.User({"Chinese":4,"Korean": 4, "Quiet": 3, "Mediterranean": 1},{"Fine arts":3,"Theatre":2},{"Movie":8,"KTV":2},{"Althetic":3,"Formal":2}, True)
user = userpref.User([["Chinese",4],["Korean",4], ["Quiet",3], ["Mediterranean",1]],[["Fine arts",3],["Theatre",2]],[["Movie",8],["KTV",2]],[["Althetic",3],["Formal",2]], True)
else:
user = userpref.User({"Chinese":4,"Korean": 4, "Quiet": 3, "Mediterranean": 1},{"Fine arts":3,"Theatre":2},{"Movie":8,"KTV":2},{"Althetic":3,"Formal":2}, False)
user = userpref.User([["Chinese",4],["Korean",4], ["Quiet",3], ["Mediterranean",1]],[["Fine arts",3],["Theatre",2]],[["Movie",8],["KTV",2]],[["Althetic",3],["Formal",2]], False)
i = 0
listCategory = {"Restaurant":0,"Arts & Culture":0,"Entertainment":0,"Shopping":0}

Expand All @@ -26,19 +26,16 @@
print("What do you want to try new in food?")
newFoodPref = input()
if (userQuery == 1):
listCategory["Arts & Culture"] = 1
print("What do you want to try new in Arts & Culture?")
newArtPref = input()
if (userQuery == 2):
listCategory["Entertainment"] = 1
print("What do you want to try new in the Entertainment?")
newEntInput = input()
if (userQuery == 3):
listCategory["Shopping"] = 1
print("What do you want to try new in the Shopping")
newShopInput = input()
if (userQuery == -1):
break
done = 1
user.otherCountryPref(newFoodPref, newArtPref, newEntInput, newShopInput)


Expand Down Expand Up @@ -133,6 +130,11 @@



print(placesApi.find_route([place['place_id'] for place in places]))
print("Done")




#Call api functions
#coordinates = "2.230225,48.817716"
Expand Down
34 changes: 18 additions & 16 deletions userpref.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class User:
data: {category(food): [specific(middle eastern), Time]}
"""

food: Dict
arts: Dict
entertainment: Dict
shopping: Dict
food: list
arts: list
entertainment: list
shopping: list
in_home_country: bool

def __init__(self, food, arts, entertainment, shopping, in_home_country):
Expand All @@ -24,23 +24,25 @@ def __init__(self, food, arts, entertainment, shopping, in_home_country):
self.shopping = shopping
self.in_home_country = in_home_country

def listExtender(self, oldlist):
newList = []
for x in oldlist:
newList.insert(0,[x,0])
return newList

def otherCountryPref(self, food, arts, entertainment, shopping):
if food != "":
foodList = food.split()
for f in foodList:
self.food[f] = ['T',0]
foodList = self.listExtender(food.split(","))
self.food.insert(0,foodList)
if arts != "":
artsList = arts.split()
for f in artsList:
self.arts[f] = ['T',0]
artsList = self.listExtender(arts.split(","))
self.arts.insert(0,artsList)
if entertainment != "":
entertainmentList = entertainment.split()
for f in entertainmentList:
self.entertainment[f] = ['T',0]
entertainmentList = self.listExtender(entertainment.split(","))
self.entertainment.insert(0,entertainmentList)
if shopping != "":
shopList = shopping.split()
for f in shopList:
self.shopping[f] = ['T',0]
shopList = self.listExtender(shopping.split(","))
self.shopping.insert(0,shopList)
print(self.food)
print(self.arts)
print(self.entertainment)
Expand Down

0 comments on commit 03947a7

Please sign in to comment.