From a910c09361171a9636a853f340d636b687015d7a Mon Sep 17 00:00:00 2001 From: Garvita Jain <42664351+garvita-jain@users.noreply.github.com> Date: Sat, 28 Sep 2019 23:50:29 +0530 Subject: [PATCH] Update __main__.py --- flyingsnake/__main__.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/flyingsnake/__main__.py b/flyingsnake/__main__.py index 2c388a4..07cb015 100644 --- a/flyingsnake/__main__.py +++ b/flyingsnake/__main__.py @@ -117,16 +117,14 @@ def flyingsnake(input_file: str, walls = Image.new("RGBA", (world.size.x, world.size.y)) draw = ImageDraw.Draw(walls) with click.progressbar(world.tiles, length = world.size) as bar: - for x in range(world.size.x): - for y in range(world.size.y): - tile = bar[x, y] + for tile in bar: if tile.wall: if draw_paint and tile.wall.paint: color = tuple(colors["Paints"][str(tile.wall.paint)]) else: color = tuple(colors["Walls"][str(tile.wall.type.value)]) draw.point((x, y), color) - + del draw to_merge.append(walls) @@ -135,9 +133,7 @@ def flyingsnake(input_file: str, liquids = Image.new("RGBA", (world.size.x, world.size.y)) draw = ImageDraw.Draw(liquids) with click.progressbar(world.tiles, length = world.size) as bar: - for x in range(world.size.x): - for y in range(world.size.y): - tile = bar[x, y] + for tile in bar: if tile.liquid: if tile.liquid.type == li.tiles.LiquidType.WATER: draw.point((x, y), tuple(colors["Globals"]["Water"])) @@ -145,7 +141,7 @@ def flyingsnake(input_file: str, draw.point((x, y), tuple(colors["Globals"]["Lava"])) elif tile.liquid.type == li.tiles.LiquidType.HONEY: draw.point((x, y), tuple(colors["Globals"]["Honey"])) - + del draw to_merge.append(liquids) @@ -154,9 +150,7 @@ def flyingsnake(input_file: str, blocks = Image.new("RGBA", (world.size.x, world.size.y)) draw = ImageDraw.Draw(blocks) with click.progressbar(world.tiles, length = world.size) as bar: - for x in range(world.size.x): - for y in range(world.size.y): - tile = bar[x, y] + for tile in bar: if tile.block: if draw_paint and tile.block.paint: color = tuple(colors["Paints"][str(tile.block.paint)]) @@ -164,6 +158,7 @@ def flyingsnake(input_file: str, color = tuple(colors["Blocks"][str(tile.block.type.value)]) draw.point((x, y), color) + del draw to_merge.append(blocks) @@ -172,9 +167,7 @@ def flyingsnake(input_file: str, wires = Image.new("RGBA", (world.size.x, world.size.y)) draw = ImageDraw.Draw(wires) with c.progressbar(world.tiles, length = world.size) as bar: - for x in range(world.size.x): - for y in range(world.size.y): - tile = bar[x, y] + for tile in bar: if tile.wiring: if tile.wiring.red: draw.point((x, y), tuple(colors["Globals"]["Wire"])) @@ -184,7 +177,7 @@ def flyingsnake(input_file: str, draw.point((x, y), tuple(colors["Globals"]["Wire2"])) if tile.wiring.yellow: draw.point((x, y), tuple(colors["Globals"]["Wire3"])) - + del draw to_merge.append(wires)