-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPiece_I.py
More file actions
59 lines (50 loc) · 1.51 KB
/
Piece_I.py
File metadata and controls
59 lines (50 loc) · 1.51 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
from Piece import Piece
class Piece_I(Piece):
def __init__(self,s):
super(Piece_I, self).__init__(s)
def move_left(self):
print "move left"
i = 0
for elm in list:
list[i][1] += 1
i = i + 1
def move_right(self):
print "move right"
i = 0
for elm in list:
list[i][1] -= 1
i = i + 1
def move_clockwise(self):
print "move clockwise"
i = 0
while i < len(object):
R = [[0, 1], [-1, 0]]
print(object[i])
v = object[i]
p = object[1]
vr = [(v[0] - p[0]), (v[1] - p[1])]
vt = []
vt.append((R[0][0] * vr[0]) + (R[0][1] * vr[1]))
vt.append((R[1][0] * vr[0]) + (R[1][1] * vr[1]))
v_final = []
v_final.append(p[0] + vt[0])
v_final.append(p[1] + vt[1])
object[i] = v_final
i += 1
def move_conter_clockwise(self):
print "move conter clokwise"
i = 0
while i < len(list):
R = [[0, -1], [1, 0]]
print(list[i])
v = list[i]
p = list[1]
vr = [(v[0] - p[0]), (v[1] - p[1])]
vt = []
vt.append((R[0][0] * vr[0]) + (R[0][1] * vr[1]))
vt.append((R[1][0] * vr[0]) + (R[1][1] * vr[1]))
v_final = []
v_final.append(p[0] + vt[0])
v_final.append(p[1] + vt[1])
list[i] = v_final
i += 1