MCPcopy Create free account
hub / github.com/BIT-MCS/DRL-eFresh / Map

Class Map

common/image/map.py:3–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1import numpy as np
2
3class Map(object):
4 def __init__(self, width, height):
5 # self.__map = np.zeros((width, height))
6 self.__width = width
7 self.__height = height
8
9 # @property
10 # def map(self):
11 # return self.__map
12 @property
13 def width(self):
14 return self.__width
15 @property
16 def height(self):
17 return self.__height
18
19 def get_value(self, x, y, map):
20 return map[x][y]
21
22 def draw_sqr(self, x, y, width, height, value, map):
23 assert 0 <= x < self.__width and 0 <= y < self.__height, 'the position ({0}, {1}) is not correct.'.format(x, y)
24 for i in range(x, x + width, 1):
25 for j in range(y, y + height, 1):
26 map[i][j] = value
27
28

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected