Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
Try to fix #19
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldObservationLog committed Jul 24, 2023
1 parent 46321a8 commit 1f3bb11
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,49 +656,49 @@ def task(self, index, name, worker):

# get target color
# target_rgb = pix[current_r, current_c]
with self._lock:
# get current pixel position from input image and replacement color
current_r, current_c, new_rgb = self.get_unset_pixel(
current_r,
current_c,
index,
)

# get current pixel position from input image and replacement color
current_r, current_c, new_rgb = self.get_unset_pixel(
current_r,
current_c,
index,
)

# get converted color
new_rgb_hex = ColorMapper.rgb_to_hex(new_rgb)
pixel_color_index = ColorMapper.COLOR_MAP[new_rgb_hex]

logger.info("\nAccount Placing: ", name, "\n")

# draw the pixel onto r/place
# There's a better way to do this
canvas = 0
pixel_x_start = self.pixel_x_start + current_r
pixel_y_start = self.pixel_y_start + current_c
if self.raw_pixel_y_start >= 0 and -500 <= self.raw_pixel_x_start < 500:
canvas = 4
elif self.raw_pixel_y_start < 0 and -500 <= self.raw_pixel_x_start < 500:
canvas = 1
elif self.raw_pixel_y_start < 0 and self.raw_pixel_x_start >= 500:
canvas = 2
elif self.raw_pixel_y_start >= 0 and self.raw_pixel_x_start >= 500:
canvas = 5
elif self.raw_pixel_y_start >= 0 and self.raw_pixel_x_start < -500:
canvas = 3
elif self.raw_pixel_y_start < 0 and self.raw_pixel_x_start < -500:
canvas = 0
# get converted color
new_rgb_hex = ColorMapper.rgb_to_hex(new_rgb)
pixel_color_index = ColorMapper.COLOR_MAP[new_rgb_hex]

logger.info("\nAccount Placing: ", name, "\n")

# draw the pixel onto r/place
next_pixel_placement_time = self.set_pixel_and_check_ratelimit(
self.access_tokens[index],
pixel_x_start,
pixel_y_start,
name,
pixel_color_index,
canvas,
index,
)
# draw the pixel onto r/place
# There's a better way to do this
canvas = 0
pixel_x_start = self.pixel_x_start + current_r
pixel_y_start = self.pixel_y_start + current_c
if self.raw_pixel_y_start >= 0 and -500 <= self.raw_pixel_x_start < 500:
canvas = 4
elif self.raw_pixel_y_start < 0 and -500 <= self.raw_pixel_x_start < 500:
canvas = 1
elif self.raw_pixel_y_start < 0 and self.raw_pixel_x_start >= 500:
canvas = 2
elif self.raw_pixel_y_start >= 0 and self.raw_pixel_x_start >= 500:
canvas = 5
elif self.raw_pixel_y_start >= 0 and self.raw_pixel_x_start < -500:
canvas = 3
elif self.raw_pixel_y_start < 0 and self.raw_pixel_x_start < -500:
canvas = 0


# draw the pixel onto r/place
next_pixel_placement_time = self.set_pixel_and_check_ratelimit(
self.access_tokens[index],
pixel_x_start,
pixel_y_start,
name,
pixel_color_index,
canvas,
index,
)

current_r += 1

Expand Down

0 comments on commit 1f3bb11

Please sign in to comment.