Advertisement
Guest User

Untitled

a guest
Mar 9th, 2021
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. class Board:
  2. def __init__(self, x, y, w, h, r, c):
  3. self.x = x
  4. self.y = y
  5. self.w = w
  6. self.h = h
  7. self.r = r
  8. self.c = c
  9. self.colors = [(255, 255, 255),
  10. (0, 0, 0)]
  11. self.rects = [
  12. (
  13. self.colors[(j + i) % 2],
  14. pygame.Rect(self.x + j * w,
  15. y + i * h,
  16. w, h)
  17. )
  18. for i in range(r)
  19. for j in range(c)]
  20.  
  21. def draw(self):
  22. for color, rect in self.rects:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement