33 lines
1018 B
Python
33 lines
1018 B
Python
def champ():
|
|
"""Create a field, ask for size, amount of orni and position of said orni
|
|
:returns: number of plan
|
|
"""
|
|
(N, M) = tuple(input("Size Quantity:").split()[:2])
|
|
field = [['🌱' for y in range(int(N))] for x in range(int(N))]
|
|
for i in range(int(M)):
|
|
(_X, _Y) = tuple(input(f"(orni {i}) X Y:").split()[:2])
|
|
field[int(_Y)][int(_X)] = '🦝'
|
|
|
|
for x in range(int(N)):
|
|
for y in range(int(N)):
|
|
if field[y][x] == '🦝':
|
|
for i in range(x-1, x+2):
|
|
for j in range(y-1, y+2):
|
|
if field[j][i] == '🥕':
|
|
field[j][i] = '💀'
|
|
if field[j][i] == '🌱':
|
|
field[j][i] = '🥕'
|
|
return field
|
|
|
|
def draw_field(field):
|
|
"""draw a field """
|
|
for x in range(len(field)):
|
|
for y in range(len(field[x])):
|
|
print(field[x][y], end=' ')
|
|
print()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
draw_field(champ())
|