-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemory_walk.py
More file actions
89 lines (73 loc) · 2.41 KB
/
memory_walk.py
File metadata and controls
89 lines (73 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# This is the Mind Palace, memory walk, or method of Loci
class MemoryPalace:
def __init__(self):
self.location = []
self.name = "Name"
def populate(self, i, iterator):
self.location.append(Location())
self.location[i].newLocation(iterator)
def displayLocations(self, index):
print()
print(self.name)
iterator = 1
for i in range(0, index + 1):
self.location[i].displayLocation(iterator)
iterator += 1
def createPalace(self):
print("What is the name of this mind palace?")
self.name = input()
# This records all the individual locations
class Location:
def __init__(self):
self.locationName = "Location name"
self.description = "Description"
self.focus = "focus"
def setLocation(self, iterator):
print("What is location {}?".format(iterator))
self.locationName = input()
def setFocus(self):
print("What is the focus of this area?")
self.focus = input()
def setDescription(self):
print("Briefly describe the area, include your focus:")
self.description = input()
def newLocation(self, iterator):
self.setLocation(iterator)
self.setFocus()
self.setDescription()
def displayLocation(self, iterator):
print()
print("Location {}: {}".format(iterator, self.locationName))
print("Focus: {}".format(self.focus))
print("Description--")
print("{}".format(self.description))
#This is to help with user error
def errorChecking(answer):
answer = answer.lower()
while (answer != 'y' and answer != 'n'):
print("Please enter y (yes) or n (no):")
answer = input()
answer = answer.lower()
return answer
#This is for a new location in the Mind Palace
def newPalaceLocation():
print()
print("Would you like to add another location to your palace? (y/n)")
newLocation = input()
return errorChecking(newLocation)
def main():
#Not the most effecient, but it would allow for searching at a later implementation
locationIndex = 0
iterator = 1
mindPalace = MemoryPalace()
mindPalace.createPalace()
mindPalace.populate(locationIndex, iterator)
response = newPalaceLocation()
while (response == 'y'):
locationIndex += 1
iterator += 1
mindPalace.populate(locationIndex, iterator)
response = newPalaceLocation()
mindPalace.displayLocations(locationIndex)
return 0
main()