my goal is for each input to activate each print the current code:
import time
P = 95
west = 'west'
north = 'north'
south = 'south'
east = 'east'
lamp = 'lamp' 'light fixture' 'lamp'
grab = 'grab', 'get,', 'retrive','take'
go = 'go', 'tavel', 'walk', 'run'
put_down = 'place', 'drop', 'put'
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#
#*similarity functions*#
from difflib import SequenceMatcher
def similar(a, b):
return SequenceMatcher(None, a, b).ratio()
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#
#print("wait for it")
#time.sleep(10)
#print("i just wasted 10 seconds of your life")
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#
def lampIn(stat):
return 'lamp' in stat or 'light fixture' in stat
def grabIn(stat):
return 'grab' in stat or 'get,' in stat or 'retrive' in stat or 'take' in stat
def westIn(stat):
return 'west' in stat
def northIn(stat):
return 'north' in stat
def southIn(stat):
return 'south' in stat
def eastIn(stat):
return 'east' in stat
def grabIn(stat):
return 'grab' in stat or 'get' in stat or 'retrieve' in stat or 'take' in stat
def goIn(stat):
return 'go' in stat or 'travel' in stat or 'walk' in stat or 'run'
def put_downIn(stat):
return 'place' in stat or 'drop' in stat or 'put' in stat
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#
while True:
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#
statement = input()
statement = statement.lower()
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#
resultGrab = similar(grab, statement)
grabResult = grabIn(statement)
for grabResult in statement or resultGrab >= P:
print("what are you getting?")
#+++++++++++++++++++++++++++++++++++++++++++++++++++++#
statement = input()
statement = statement.lower()
#+++++++++++++++++++++++++++++++++++++++++++++++++++++#
resultLamp = similar(lamp, statement)
lampResult = lampIn(statement)
for lampResult in statement or resultLamp >= P:
print("you now have the lamp")
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++#
resultGo = similar(go, statement)
goResult = goIn(statement)
for goResult in statement or resultGo >= P:
print("Where?")
#+++++++++++++++++++++++++++++++++++++++++++++++++++++#
statement = input()
statement = statement.lower()
#+++++++++++++++++++++++++++++++++++++++++++++++++++++#
resultWest = similar(west, statement)
westResult = westIn(statement)
for westResult in statement or resultWest >= P:
print("You went west.")
else: print("not a command yet")
the result:
walk what are you getting? est you now have the lamp you now have the lamp you now have the lamp you now have the lamp what are you getting?
the result im trying to achieve:
walk where? west you went west
while also maintaining each individual path
Aucun commentaire:
Enregistrer un commentaire