-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
70 lines (56 loc) · 1.94 KB
/
main.py
File metadata and controls
70 lines (56 loc) · 1.94 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
import sys
from street import Street, Streets, Point
# YOUR CODE GOES HERE
totalStreets = []
def main():
# YOUR MAIN CODE GOES HERE
myStreets = Streets()
try:
global totalStreets
generated =0
# sample code to read from stdin.
# make sure to remove all spurious print statements as required
# by the assignment
while True:
print("Enter command: ")
line = sys.stdin.readline()
command = line[0]
print(len(line))
coords =[]
if command=="a":
print("Add Street")
flagQ = False
strName = ""
for i in range(1, len(line)):
if (flagQ):
if(line[i]!="\""):
strName += line[i]
if line[i]=="\"":
if (flagQ):
flagQ = False
else:
flagQ = True
coord = []
if(line[i]=="("):
coord.append(int(line[i+1]))
coord.append(int(line[i+3]))
coords.append(coord)
myStreets.addStreet(name=strName, points=coords)
myStreets.print()
myStreets.checkIntersections()
myStreets.printVertices()
elif command=="c":
print("Change Street")
elif command == "r":
print("Delete Street")
elif command == "g":
print("Generate Graph")
else:
print("Invalid command.")
#myStreet.streetName , myStreet.streetPath = su.parseInput(line)
sys.exit(0)
except Exception as e:
print("Error : \n" + str(e), file=sys.stderr)
if __name__ == "__main__":
main()
# print(command)