-
Notifications
You must be signed in to change notification settings - Fork 0
/
navgapapp_v0.py
125 lines (112 loc) · 3.4 KB
/
navgapapp_v0.py
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
### Navgap App ver. 0
## Simple navigation between 3 points, hardcoded.
# Written by Michel Baartman & Daniel van Vliet
import sys
print(sys.version)
print()
print(sys.version_info)
print()
print(sys.api_version)
## defines description for route
dirL = 'links '
dirR = 'rechts '
dirF = 'vooruit '
dirB = 'achteruit '
locList = [
'a',
'b',
'c'
]
locCon = [
['a','b',1, dirF, dirL],
['b','a',1, dirL, dirF],
['b','c',2, dirF, dirL],
['c','b',2, dirF, dirR],
]
conDict = {
}
## list for pathing between points.
locConP1 = [
['a', 'b', dirF, dirL, dirF],
['a', 'c', dirF, dirL, dirF, dirR, dirF, dirL, dirF],
['b', 'c', dirF, dirL, dirF]
]
## function to determine path
def prototype1(startLoc, endLoc):
routeList = []
for each in locConP1: ## checks each line in list locConP1
if each[0] == startLoc and each[1] == endLoc: ## if it finds the right pre-determined route, it adds the route to routeList
counter = 2
while counter < len(each):
routeList.append(each[counter])
counter += 1
if each[1] == startLoc and each[0] == endLoc: ## if it can't find the path, it then turns the checks around
counter = len(each) ## if it finds the reversed checks, then adds the directions to routeList
while counter > 2: ## in a reversed manner.
if each[counter-1] == dirR: ## swaps dirR with dirL
routeList.append(dirL)
elif each[counter-1] == dirL: ## swaps dirL with dirR
routeList.append(dirR)
else:
routeList.append(each[counter-1])
counter -= 1
for each in routeList:
print(str(each)) ## prints routeList
## basic algorithm test, WIP
# def knitRoute(startLoc, endLoc):
# routeList = []
# fastDist = 0
#
# routeList2 = []
# currentLoc = []
# curDist = 0
#
#
# # routebes knit algo ##
# for each in locCon:
# if each[0] == startLoc:
# currentLoc.append(startLoc)
# currentLoc.append(each[1])
# curDist += each[2]
# print('{} > {}, Distance: {}'.format(currentLoc[0], currentLoc[1], curDist))
#
# if each[1] == endLoc:
# counter = 3
# while counter < len(each):
# routeList2.append(each[counter])
# counter += 1
#
# if curDist < fastDist:
# fastDist = curDist
#
# print(routeList2)
#
#
#
# # for each in locCon:
# # if each[0] == startLoc:
# # counter = 2
# # while counter < len(each):
# # routeList.append(each[counter])
# # counter += 1
# # print(routeList)
while True: ## start of the application loop
print()
print('-startapp-')
print('------------')
startLoc = input('startLoc: ')
if startLoc == 'end': ## you can break the app by entering "end" as start loc
print('ending app')
break
endLoc = input('endLoc: ')
prototype1(startLoc, endLoc) ## runs the algorithm script
# update() ## in the future, update will probably be located somewhere in this list
#knitRoute(startLoc, endLoc)
#print(locCon[0][2])
print('------------')
print('-endapp-')
print()
hallo1 = 1
hallo2 = 3
print('hello world.')
print('{}{}'.format(hallo1, hallo2))