Pass colored pixels

main
justuser31 2 years ago
parent df06ca94a3
commit 4f5e14e131

@ -5,17 +5,27 @@ from tqdm import tqdm
global xc, yc global xc, yc
xc = 0 ; yc = 0 xc = 0 ; yc = 0
def gcolor(x, y):
response = requests.get(f'http://pb.dmcraft.online/?get_color={x},{y}')
return response.text
def draw(cords, color = "black"): def draw(cords, color = "black"):
global xc, yc global xc, yc
for i in tqdm(range(len(cords))): for i in tqdm(range(len(cords))):
payload = {'x': cords[i][1] + yc, 'y': cords[i][0] + xc, 'color': color } try:
color = cords[i][2]
response = requests.post('http://pb.dmcraft.online', data=payload) except:
pass
if str(gcolor(cords[i][1], cords[i][0])) != color:
payload = {'x': cords[i][1] + yc, 'y': cords[i][0] + xc, 'color': color }
while str(response) != "<Response [200]>":
response = requests.post('http://pb.dmcraft.online', data=payload) response = requests.post('http://pb.dmcraft.online', data=payload)
print("Error, retrying...")
sleep(0.1) while str(response) != "<Response [200]>":
response = requests.post('http://pb.dmcraft.online', data=payload)
print("Error, retrying...")
sleep(0.1)
print("DONE!") print("DONE!")
def linex(y, x1, x2): def linex(y, x1, x2):
@ -40,10 +50,9 @@ def fill(xy1, xy2):
#xc = 500 print(gcolor(0, 1))
#yc = 500 draw([[0,1, "red"]])
draw(fill([26,0], [50, 85]),"white")
''' '''
#Russian flag #Russian flag

Loading…
Cancel
Save