-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpath.py
More file actions
98 lines (85 loc) · 3.5 KB
/
path.py
File metadata and controls
98 lines (85 loc) · 3.5 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
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
class Path:
"""
A class representing a path of moves for Tetris block movement.
Attributes:
moves (list): A list of moves representing block rotation and placement.
height (int): The maximum height of the grid after block placement.
lines_cleared (int): The number of lines cleared in the grid after block placement.
holes (int): The number of holes in the grid after block placement.
blockades (int): The number of blockades in the grid after block placement.
game_over_move (bool): Indicates if the move results in a game over.
rank (float): The rank assigned to the path based on different factors.
"""
def __init__(self):
"""
Initializes the Path class with default values.
"""
self.moves = []
self.height = 0
self.lines_cleared = 0
self.holes = 0
self.blockades = 0
self.game_over_move = False
self.rank = 0
def set_moves(self, moves):
"""
Sets the list of moves for the path.
Args:
moves (list): A list of moves representing block rotation and placement.
"""
self.moves = moves
def set_attributes(self, height, lines_cleared, holes, blockades):
"""
Sets the attributes of the path.
Args:
height (int): The maximum height of the grid after block placement.
lines_cleared (int): The number of lines cleared in the grid after block placement.
holes (int): The number of holes in the grid after block placement.
blockades (int): The number of blockades in the grid after block placement.
"""
self.height = height
self.lines_cleared = lines_cleared
self.holes = holes
self.blockades = blockades
def set_rank(self, rank):
"""
Sets the rank of the path.
Args:
rank (float): The rank assigned to the path based on different factors.
"""
self.rank = rank
def set_game_over_move(self, game_over_move):
"""
Sets whether the move results in a game over.
Args:
game_over_move (bool): Indicates if the move results in a game over.
"""
self.game_over_move = game_over_move
def set_path(self, moves, height, lines_cleared, holes, blockades, game_over_move):
"""
Sets all attributes of the path.
Args:
moves (list): A list of moves representing block rotation and placement.
height (int): The maximum height of the grid after block placement.
lines_cleared (int): The number of lines cleared in the grid after block placement.
holes (int): The number of holes in the grid after block placement.
blockades (int): The number of blockades in the grid after block placement.
game_over_move (bool): Indicates if the move results in a game over.
"""
self.moves = moves
self.height = height
self.lines_cleared = lines_cleared
self.holes = holes
self.blockades = blockades
self.game_over_move = game_over_move
def print_details(self):
"""
Prints the details of the path.
"""
print("Moves:", self.moves)
print("Height:", self.height)
print("Lines Cleared:", self.lines_cleared)
print("Holes:", self.holes)
print("Blockades:", self.blockades)
print("Rank:", self.rank)
print("Game Over Move:", self.game_over_move)