class charCanvas:
def __init__(self,width,height):
self.width = width
self.height = height
self.data = [list(' '*height) for count in range(0,width)]
def paste(self,x,y,picture):
startX = x
startY = y
height = len(picture)
if y + height > self.height:
height -= y + height - self.height
width = len(picture[0])
if x + width > self.width:
width -= x + width - self.width
for y in range(startY,startY + height):
for x in range(startX,startX + width):
self.data[x][y] = picture[y - startY][x - startX]
def show(self):
for y in range(0,self.height):
for x in range(0,self.width):
print(self.data[x][y],end='')
print()
mario = [
' ******** ',
' ************ ',
' ####....#. ',
' #..###.....##.... ',
' ###.......###### ',
' ........... ',
' ##*####### ',
' ####*******###### ',
'...#***.****.*###....',
'....**********##.....',
'....**** *****....',
' #### #### ',
'###### ###### '
]
gold = [
' ### ',
'#...#',
'#.#.#',
'#.#.#',
'#...#',
' ### '
]
ground = [
'##########################################',
'#...#......#.##...#......#.##...#......#.#',
'##########################################',
'#..#....#....##..#....#....##..#....#....#',
'##########################################',
'#.....#......##.....#......##.....#......#',
'##########################################',
'#.#..#....#..##.#..#....#..##.#..#....#..#',
'##########################################'
]
pipe = [
'####################',
'#------------------#',
'#------------------#',
'####################',
' #----------# ',
' #----------# ',
' #----------# ',
' #----------# ',
' ############ '
]
paper = charCanvas(62,22)
paper.paste(10,0,mario)
paper.paste(42,4,gold)
paper.paste(57,4,gold)
paper.paste(0,13,ground)
paper.paste(42,13,pipe)
paper.show()