@@ -42,6 +42,15 @@ def __init__(self) -> None:
42
42
self .data : int
43
43
self .coordinates : tuple (int , int )
44
44
45
+ def __str__ (self ) -> str :
46
+ res = self .type .name
47
+ if self .type in [MapType .OUT_OF_SIGHT , MapType .OUT_OF_MAP ]:
48
+ return res .center (16 )
49
+ elif self .type in [MapType .AGENT , MapType .GOLD ]:
50
+ res += f':{ self .data } '
51
+ res += f' ({ self .coordinates [0 ]} ,{ self .coordinates [1 ]} )'
52
+ return res .center (16 )
53
+
45
54
46
55
class Map :
47
56
def __init__ (self ) -> None :
@@ -51,6 +60,15 @@ def __init__(self) -> None:
51
60
self .sight_range : int
52
61
self .grid : list
53
62
63
+ def __str__ (self ) -> str :
64
+ res = f'sight range -> { self .sight_range } \n '
65
+ for i in range (self .sight_range ):
66
+ res += '\t '
67
+ for j in range (self .sight_range ):
68
+ res += str (self .grid [i * self .sight_range + j ])
69
+ res += '*' if j < 4 else '\n '
70
+ return res [:- 1 ]
71
+
54
72
def set_grid_size (self ) -> None :
55
73
self .grid = [MapTile () for _ in range (self .sight_range ** 2 )]
56
74
@@ -74,6 +92,7 @@ def set_info(self) -> None:
74
92
self .location = tuple (map (int , input ().split ())) # (row, column)
75
93
for tile in self .map .grid :
76
94
tile .type , tile .data , * tile .coordinates = map (int , input ().split ())
95
+ tile .type = MapType (tile .type )
77
96
self .agent_id = int (input ()) # player1: 0,1 --- player2: 2,3
78
97
self .current_round = int (input ()) # 1 indexed
79
98
self .attack_ratio = float (input ())
@@ -88,6 +107,7 @@ def debug(self) -> None:
88
107
# Customize to your needs
89
108
self .debug_log += f'round: { str (self .current_round )} \n '
90
109
self .debug_log += f'location: { str (self .location )} \n '
110
+ self .debug_log += f'Map: { str (self .map )} \n '
91
111
self .debug_log += f'attack ratio: { str (self .attack_ratio )} \n '
92
112
self .debug_log += f'defence level: { str (self .deflvl )} \n '
93
113
self .debug_log += f'attack level: { str (self .atklvl )} \n '
0 commit comments