Files
pyDefis/Dessine-moi des Pokémons.py
Francois JUMELLE 20526d93c8 Initial release
2021-05-03 22:32:40 +02:00

45 lines
916 B
Python

from PIL import Image
input = open("DessineMoiDesPokemons.txt").read()
# input="""10 10
# (3,3) 3
# (3,6) 1
# (5,3) 7 0 1
# (2,2) 5 6 6 6 7 7 0 0 0 1 1 2 2 2 3
# (2,2) 1 0 0 0 7"""
input = input.splitlines()
height, width = input[0].split()
img = Image.new("RGB", (int(width), int(height)))
for line in input[1:]:
data = line.split()
x,y = [int(v) for v in data[0].replace("(","").replace(")","").split(",")]
img.putpixel((y,x), (255,255,255))
for d in data[1:]:
if d == '0':
y+=1
if d == '1':
x-=1
y+=1
if d == '2':
x-=1
if d == '3':
x-=1
y-=1
if d == '4':
y-=1
if d == '5':
y-=1
x+=1
if d == '6':
x+=1
if d == '7':
y+=1
x+=1
img.putpixel((y,x), (255,255,255))
img.show()