2022-07-24 17:25:22 +00:00
|
|
|
class GameMap:
|
|
|
|
|
|
|
|
def __init__(self, max_size_x = float('inf'), max_size_y = float('inf')):
|
|
|
|
self.max_size_x = max_size_x
|
|
|
|
self.max_size_y = max_size_y
|
|
|
|
data = {}
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return data
|
|
|
|
|
|
|
|
|
|
|
|
def get_max_size_x(self):
|
|
|
|
return self.size_x
|
|
|
|
|
|
|
|
|
|
|
|
def get_max_size_y(self):
|
|
|
|
return self.size_y
|
|
|
|
|
|
|
|
|
|
|
|
def add_player_mark(self, x, y, player):
|
|
|
|
if x <= max_size_x or y <= max_size_y:
|
|
|
|
self.data[(x,y)] = player
|
|
|
|
else:
|
2022-07-25 08:00:19 +00:00
|
|
|
raise IndexError("Mark added beyond preset max values (max_x - " + self.max_size_x + ", max_y - " + self.max_size_y + ".")
|
2022-07-24 17:25:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
def clear_map(self):
|
|
|
|
self.data = {}
|
|
|
|
|