def __init__(self, source):
    self.coin = 0
    self.lines = source.split('\n')
    self._grid = []
    for line in range((len(self.lines) - 1)):
        if (self.lines[line] in ['', '\n', ' ', '\t']):
            del self.lines[line]
    for (y, line) in enumerate(self.lines):
        self._grid.append([])
        for (x, char) in enumerate(line):
            self._grid[y].append(Block(x, y, char))
            if (self._grid[y][x].blockType == 'playerspawn'):
                self.spawn = (x, y)
            elif (self._grid[y][x].blockType == 'coin'):
                self.coin += 1
    del self.lines
def __init__(self, source):
    self.coin = 0
    self.lines = source.split('\n')
    self._grid = []
    for line in range((len(self.lines) - 1)):
        if (self.lines[line] in [, '\n', ' ', '\t']):
            del self.lines[line]
    for (y, line) in enumerate(self.lines):
        self._grid.append([])
        for (x, char) in enumerate(line):
            self._grid[y].append(Block(x, y, char))
            if (self._grid[y][x].blockType == 'playerspawn'):
                self.spawn = (x, y)
            elif (self._grid[y][x].blockType == 'coin'):
                self.coin += 1
    del self.lines