Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # buffer 30 rows, 40 columns
- screen = [ [" "]*40 for r in range(30) ]
- #-----------------------------------------------------
- # function to add H to buffer in position (x,y)
- def H(x, y):
- global screen
- for row in range(7):
- for col in range(5):
- if col == 0 or col == 4 or row == 3:
- screen[row+y][col+x] = '*'
- else:
- screen[row+y][col+x] = ' '
- # function to add A to buffer in position (x,y)
- def A(x, y):
- global screen
- for row in range(7):
- for col in range(5):
- if col == 0 or col == 4 or row == 0 or row == 3:
- screen[row+y][col+x] = '*'
- else:
- screen[row+y][col+x] = ' '
- # function to display buffer
- def display():
- for row in screen:
- print(''.join(row))
- #-----------------------------------------------------
- # add many H to buffer
- H(0, 0)
- A(7, 0)
- H(14, 8)
- A(21, 8)
- H(28, 16)
- A(35, 16)
- # display current buffer
- display()
- # result
- '''
- * * *****
- * * * *
- * * * *
- ***** *****
- * * * *
- * * * *
- * * * *
- * * *****
- * * * *
- * * * *
- ***** *****
- * * * *
- * * * *
- * * * *
- * * *****
- * * * *
- * * * *
- ***** *****
- * * * *
- * * * *
- * * * *
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement