-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndexing.py
134 lines (113 loc) · 4.32 KB
/
Indexing.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
126
127
128
129
130
131
132
133
134
__author__ = 'moorerm'
import turtle
from Stack import Stack
class Index():
stack = Stack() #stack call
def __init__(self):
self.indexpacman = turtle.Turtle()
self.X = -480
self.Y = -300
self.pathX = Stack()#Stack()
self.pathY = Stack()
self.blockX = Stack()
self.blockY = Stack()
def shift(self):
"""
post: shhift Y values for new row
"""
self.Y += 40 #move Y values over
#self.X = -480
self.indexpacman.goto(self.X,self.Y) #sets new psotion
def reset_shift(self):
"""
post: resets the shift for bottom row
"""
self.Y = -300 #sets Y value
self.X += 40
self.indexpacman.goto(self.X,self.Y) #setts new positon
def dots(self):
"""
post: position
"""
self.Y =+ 40
def check_dots(self):
"""
post: compares X and Y values for blocked positons
"""
a = [-140,-20,20,60,180,220,260] #list for y values
for i in a: #loop to iterate thru list
if self.X == -200 and self.Y == i or self.X == 200 and self.Y == i : #compares X and Y values
self.blockX.push(self.X) #push value into list
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y) #goes to specific position
b = [-220,-180,-140,-100,-60,20,60,100,140,180]
for i in b:
if self.X == -360 and self.Y == i or self.X == 360 and self.Y == i:
self.blockX.push(-360)
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y)
c = [-140]
for i in c:
if self.X == -400 and self.Y == i or self.X == 400 and self.Y == i:
self.blockX.push(-400)
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y)
d = [-140]
for i in d:
if self.X == -440 and self.Y == i or self.X == 440 and self.Y == i:
self.blockX.push(-440)
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y)
e = [-140,100]
for i in e:
if self.X == -320 and self.Y == i or self.X == 320 and self.Y == i:
self.blockX.push(-320)
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y)
f = [-140,100]
for i in f:
if self.X == -280 and self.Y == i or self.X == 280 and self.Y == i:
self.blockX.push(-280)
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y)
g = [-140,260]
for i in g:
if self.X == -160 and self.Y == i or self.X == 160 and self.Y == i:
self.blockX.push(-160)
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y)
h = [-300,-260,-220,-140,260]
for i in h:
if self.X == -120 and self.Y == i or self.X == 120 and self.Y == i:
self.blockX.push(-120)
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y)
j = [-60,100]
for i in j:
if self.X == -80 and self.Y == i or self.X == 80 and self.Y == i:
self.blockX.push(-80)
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y)
k = [-260,-60,100]
for i in k:
if self.X == -40 and self.Y == i or self.X == 40 and self.Y == i:
self.blockX.push(-20)
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y)
l = [-260,-140,-100,-60,100,140,180]
for i in l:
if self.X == 0 and self.Y == i:
self.blockX.push(20)
self.blockY.push(self.Y)
self.Y += 40
self.indexpacman.goto(self.X,self.Y)