-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpiece.py
More file actions
46 lines (42 loc) · 1.16 KB
/
piece.py
File metadata and controls
46 lines (42 loc) · 1.16 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
class Piece:
form = None
height = 0
width = 0
piece_type = 0
def __init__(self, type):
if type == 1:
self.form = [[1]]
self.height = 1
self.width = 1
self.piece_type = type
if type == 2:
self.form = [[1],[1],[1]]
self.height = 3
self.width = 1
self.piece_type = type
if type == 3:
self.form = [[1,1],[1,1]]
self.height = 2
self.width = 2
self.piece_type = type
if type == 4:
self.form = [[1,1,0],[0,1,1]]
self.height = 2
self.width = 3
self.piece_type = type
if type == 5:
self.form = [[1,0],[1,1]]
self.height = 2
self.width = 2
self.piece_type = type
if type == 6:
self.form = [[1,1],[0,1]]
self.height = 2
self.width = 2
self.piece_type = type
def __str__(self):
text = '------------------\n'
for i in self.form:
text += str(i) + '\n'
text += '------------------'
return text