Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

[BUG] Multiple accounts placing the same pixel. #364

Open
tylerval18 opened this issue Apr 4, 2022 · 7 comments
Open

[BUG] Multiple accounts placing the same pixel. #364

tylerval18 opened this issue Apr 4, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@tylerval18
Copy link

Screenshot 2022-04-03 205029

@tylerval18 tylerval18 added the bug Something isn't working label Apr 4, 2022
@Soneliem
Copy link

Soneliem commented Apr 4, 2022

What thread_delay have you set? I have mine at 7 and have no issue

@tylerval18
Copy link
Author

What thread_delay have you set? I have mine at 7 and have no issue

was at 5, changed it to 10 and its slightly better but still repeats sometimes

@Phyronian
Copy link

In your config file, stagger each account's start coords. I've found that it helps a lot with it not repeating pixels.
[0,0], [0,1], [0,2], [1,0], [1,1], [1,2], etc....

@jonnyswboy
Copy link

I am having the same issue, thread delay 8. When I start it up it will replace pixels with the same color they already are.

@clarkb7
Copy link

clarkb7 commented Apr 4, 2022

patch that uses a lock and a delay

diff --git a/main.py b/main.py
index 17ca04b..769a77f 100755
--- a/main.py
+++ b/main.py
@@ -58,6 +58,9 @@ class PlaceClient:
         # Initialize-functions
         self.load_image()
 
+        # place lock
+        self._image_lock = threading.Lock()
+
     """ Utils """
     # Convert rgb tuple to hexadecimal string
 
@@ -481,37 +484,40 @@ class PlaceClient:
                     # get target color
                     # target_rgb = pix[current_r, current_c]
 
-                    # get current pixel position from input image and replacement color
-                    current_r, current_c, new_rgb = self.get_unset_pixel(
-                        self.get_board(self.access_tokens[index]),
-                        current_r,
-                        current_c,
-                        index,
-                    )
+                    with self._image_lock:
+                        # get current pixel position from input image and replacement color
+                        current_r, current_c, new_rgb = self.get_unset_pixel(
+                            self.get_board(self.access_tokens[index]),
+                            current_r,
+                            current_c,
+                            index,
+                        )
 
-                    # get converted color
-                    new_rgb_hex = self.rgb_to_hex(new_rgb)
-                    pixel_color_index = 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
-                    while pixel_x_start > 999:
-                        pixel_x_start -= 1000
-                        canvas += 1
-
-                    # 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,
-                        pixel_color_index,
-                        canvas,
-                    )
+                        # get converted color
+                        new_rgb_hex = self.rgb_to_hex(new_rgb)
+                        pixel_color_index = 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
+                        while pixel_x_start > 999:
+                            pixel_x_start -= 1000
+                            canvas += 1
+
+                        # 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,
+                            pixel_color_index,
+                            canvas,
+                        )
+                        # Sleep with lock to give board time to update
+                        time.sleep(5)
 
                     current_r += 1
 

@deleniti
Copy link

deleniti commented Apr 4, 2022

Latest version seems to have fixed this.

@MatthewBentz
Copy link

MatthewBentz commented Apr 4, 2022

I've got this same issue

EDIT: Raising thread delay helped

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants