fork download
  1. ## vim: fileencoding=utf-8
  2.  
  3. class Board:
  4. def __init__(self, size):
  5. self.size = size
  6. self.data = [[0 for i in range(size)]
  7. for j in range(size)]
  8. def draw(self):
  9. for x in range(0, self.size):
  10. for y in range(0, self.size):
  11. if self.data[x][y] == 0:
  12. print "+",
  13. else:
  14. print "●",
  15. print
  16.  
  17. def sample(self):
  18. self.data[0][0] = 1
  19. self.data[2][3] = 1
  20.  
  21. b = Board(5)
  22. b.sample()
  23. b.draw()
Success #stdin #stdout 0.01s 7736KB
stdin
Standard input is empty
stdout
● + + + +
+ + + + +
+ + + ● +
+ + + + +
+ + + + +