Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

toolkit.py 434B

il y a 5 ans
123456789101112
  1. def render(grid, brush):
  2. if isinstance(brush, str):
  3. brush = {i: c for i, c in enumerate(brush)}
  4. xmin, *_, xmax = sorted(int(p.real) for p in grid)
  5. ymin, *_, ymax = sorted(int(p.imag) for p in grid)
  6. brush[None] = ' '
  7. rendered = ''
  8. for y in range(ymin, ymax + 1):
  9. for x in range(xmin, xmax + 1):
  10. rendered += brush[grid.get(complex(x, y))]
  11. rendered += '\n'
  12. return rendered