Imadethis
Imadethis
import cv2
import numpy as np
import time
import threading
import pygetwindow as gw
import random # Importing the random module for random delays
block_shapes = []
return grid
return matches
# Main loop to capture the screen, process the grid, and make moves
def main():
global running
monitor_thread = threading.Thread(target=monitor_right_click)
monitor_thread.start()
while running:
frame = capture_screen(region=(100, 100, 800, 800)) # Adjust region based
on your game window
grid = identify_blocks(frame)
matches = find_matches(grid)
if matches:
# Make the first match move
match = matches[0]
simulate_move(match[0], match[1])
# Adding a random delay between 2 and 3 seconds before making the next move
time.sleep(random.uniform(2, 3))
monitor_thread.join()
if __name__ == "__main__":
main()