Skip to content

Commit

Permalink
Simplify comparisons inside if
Browse files Browse the repository at this point in the history
These were suggested by PyCharm.
  • Loading branch information
merfolk committed Apr 15, 2020
1 parent 601d228 commit 0df333e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions sharpy/plans/acts/defensive_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ async def execute(self) -> bool:
for y in range(-2, 2):
pos = int_pos + Point2((x, y))
if (
pos.x > 0
and pos.x < self.ai.state.creep.width
and pos.y > 0
and pos.y < self.ai.state.creep.height
0 < pos.x < self.ai.state.creep.width
and 0 < pos.y < self.ai.state.creep.height
and self.ai.state.creep.is_set(pos)
):
can_build = True
Expand Down
6 changes: 2 additions & 4 deletions sharpy/plans/acts/position_building.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ async def actually_build(self, ai, count):
for y in range(-2, 2):
pos = int_pos + Point2((x, y))
if (
pos.x > 0
and pos.x < self.ai.state.creep.width
and pos.y > 0
and pos.y < self.ai.state.creep.height
0 < pos.x < self.ai.state.creep.width
and 0 < pos.y < self.ai.state.creep.height
and self.ai.state.creep.is_set(pos)
):
can_build = True
Expand Down

0 comments on commit 0df333e

Please sign in to comment.