You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
6.8 KiB

import requests
from time import sleep
from tqdm import tqdm
global xc, yc
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"):
global xc, yc
for i in tqdm(range(len(cords))):
sleep(0.01)
try:
color = cords[i][2]
except:
pass
#if str(gcolor(cords[i][1], cords[i][0])) != color:
if True:
payload = {'x': cords[i][1] + yc, 'y': cords[i][0] + xc, 'color': color }
response = requests.post('http://pb.dmcraft.online', data=payload)
#response = requests.post('http://127.0.0.1:3333', data=payload)
while str(response) != "<Response [200]>":
response = requests.post('http://pb.dmcraft.online', data=payload)
print("Error, retrying...")
sleep(0.1)
print("DONE!")
def linex(y, x1, x2):
res = []
for i in range(x1, x2+1):
res.append( [i,y] )
return res
def liney(x, y1, y2):
res = []
for i in range(y1, y2+1):
res.append( [x,i] )
return res
def fill(xy1, xy2):
res = []
for x in range(xy1[0], xy2[0] + 1):
for y in range(xy1[1], xy2[1] + 1):
res.append( [x, y] )
return res
l = [[300, 315, 'black'], [300, 314, 'black'], [300, 313, 'black'], [300, 312, 'black'], [300, 311, 'black'], [300, 310, 'black'], [300, 309, 'black'], [300, 308, 'black'], [300, 307, 'black'], [300, 306, 'black'], [300, 305, 'black'], [300, 304, 'black'], [300, 303, 'black'], [300, 302, 'black'], [300, 301, 'black'], [300, 300, 'black'], [301, 315, 'black'], [301, 314, 'black'], [301, 313, 'black'], [301, 312, 'black'], [301, 311, 'black'], [301, 310, 'black'], [301, 309, 'black'], [301, 308, 'black'], [301, 307, 'black'], [301, 306, 'black'], [301, 305, 'black'], [301, 304, 'black'], [301, 303, 'black'], [301, 302, 'black'], [301, 301, 'black'], [301, 300, 'black'], [302, 315, 'black'], [302, 314, 'black'], [302, 313, 'black'], [302, 312, 'black'], [302, 311, 'black'], [302, 310, 'black'], [302, 309, 'black'], [302, 308, 'black'], [302, 307, 'red'], [302, 306, 'red'], [302, 305, 'black'], [302, 304, 'black'], [302, 303, 'black'], [302, 302, 'black'], [302, 301, 'black'], [302, 300, 'black'], [303, 315, 'black'], [303, 314, 'black'], [303, 313, 'black'], [303, 312, 'black'], [303, 311, 'black'], [303, 310, 'black'], [303, 309, 'black'], [303, 308, 'black'], [303, 307, 'black'], [303, 306, 'red'], [303, 305, 'red'], [303, 304, 'black'], [303, 303, 'black'], [303, 302, 'black'], [303, 301, 'black'], [303, 300, 'black'], [304, 315, 'black'], [304, 314, 'black'], [304, 313, 'red'], [304, 312, 'red'], [304, 311, 'red'], [304, 310, 'red'], [304, 309, 'red'], [304, 308, 'black'], [304, 307, 'black'], [304, 306, 'black'], [304, 305, 'red'], [304, 304, 'black'], [304, 303, 'black'], [304, 302, 'black'], [304, 301, 'black'], [304, 300, 'black'], [305, 315, 'black'], [305, 314, 'black'], [305, 313, 'black'], [305, 312, 'black'], [305, 311, 'black'], [305, 310, 'black'], [305, 309, 'black'], [305, 308, 'black'], [305, 307, 'black'], [305, 306, 'black'], [305, 305, 'red'], [305, 304, 'black'], [305, 303, 'black'], [305, 302, 'black'], [305, 301, 'black'], [305, 300, 'black'], [306, 315, 'black'], [306, 314, 'black'], [306, 313, 'black'], [306, 312, 'black'], [306, 311, 'black'], [306, 310, 'black'], [306, 309, 'black'], [306, 308, 'black'], [306, 307, 'black'], [306, 306, 'black'], [306, 305, 'red'], [306, 304, 'black'], [306, 303, 'black'], [306, 302, 'black'], [306, 301, 'black'], [306, 300, 'black'], [307, 315, 'black'], [307, 314, 'black'], [307, 313, 'black'], [307, 312, 'black'], [307, 311, 'black'], [307, 310, 'black'], [307, 309, 'black'], [307, 308, 'black'], [307, 307, 'black'], [307, 306, 'black'], [307, 305, 'red'], [307, 304, 'black'], [307, 303, 'black'], [307, 302, 'black'], [307, 301, 'black'], [307, 300, 'black'], [308, 315, 'black'], [308, 314, 'black'], [308, 313, 'red'], [308, 312, 'red'], [308, 311, 'red'], [308, 310, 'red'], [308, 309, 'black'], [308, 308, 'black'], [308, 307, 'black'], [308, 306, 'black'], [308, 305, 'red'], [308, 304, 'black'], [308, 303, 'black'], [308, 302, 'black'], [308, 301, 'black'], [308, 300, 'black'], [309, 315, 'black'], [309, 314, 'black'], [309, 313, 'black'], [309, 312, 'black'], [309, 311, 'black'], [309, 310, 'black'], [309, 309, 'black'], [309, 308, 'black'], [309, 307, 'black'], [309, 306, 'red'], [309, 305, 'red'], [309, 304, 'black'], [309, 303, 'black'], [309, 302, 'black'], [309, 301, 'black'], [309, 300, 'black'], [310, 315, 'black'], [310, 314, 'black'], [310, 313, 'black'], [310, 312, 'black'], [310, 311, 'black'], [310, 310, 'black'], [310, 309, 'black'], [310, 308, 'black'], [310, 307, 'black'], [310, 306, 'red'], [310, 305, 'red'], [310, 304, 'black'], [310, 303, 'black'], [310, 302, 'black'], [310, 301, 'black'], [310, 300, 'black'], [311, 315, 'black'], [311, 314, 'black'], [311, 313, 'black'], [311, 312, 'black'], [311, 311, 'black'], [311, 310, 'black'], [311, 309, 'black'], [311, 308, 'black'], [311, 307, 'red'], [311, 306, 'red'], [311, 305, 'black'], [311, 304, 'black'], [311, 303, 'black'], [311, 302, 'black'], [311, 301, 'black'], [311, 300, 'black'], [312, 315, 'black'], [312, 314, 'black'], [312, 313, 'black'], [312, 312, 'black'], [312, 311, 'black'], [312, 310, 'black'], [312, 309, 'black'], [312, 308, 'black'], [312, 307, 'black'], [312, 306, 'black'], [312, 305, 'black'], [312, 304, 'black'], [312, 303, 'black'], [312, 302, 'black'], [312, 301, 'black'], [312, 300, 'black'], [313, 315, 'black'], [313, 314, 'black'], [313, 313, 'black'], [313, 312, 'black'], [313, 311, 'black'], [313, 310, 'black'], [313, 309, 'black'], [313, 308, 'black'], [313, 307, 'black'], [313, 306, 'black'], [313, 305, 'black'], [313, 304, 'black'], [313, 303, 'black'], [313, 302, 'black'], [313, 301, 'black'], [313, 300, 'black'], [314, 315, 'black'], [314, 314, 'black'], [314, 313, 'black'], [314, 312, 'black'], [314, 311, 'black'], [314, 310, 'black'], [314, 309, 'black'], [314, 308, 'black'], [314, 307, 'black'], [314, 306, 'black'], [314, 305, 'black'], [314, 304, 'black'], [314, 303, 'black'], [314, 302, 'black'], [314, 301, 'black'], [314, 300, 'black'], [315, 315, 'black'], [315, 314, 'black'], [315, 313, 'black'], [315, 312, 'black'], [315, 311, 'black'], [315, 310, 'black'], [315, 309, 'black'], [315, 308, 'black'], [315, 307, 'black'], [315, 306, 'black'], [315, 305, 'black'], [315, 304, 'black'], [315, 303, 'black'], [315, 302, 'black'], [315, 301, 'black'], [315, 300, 'black']]
draw(l)
'''
#Russian flag
draw(fill([300,300], [330, 300]))
draw(fill([300,330], [330, 330]))
draw(fill([300,300], [300, 330]))
draw(fill([330,300], [330, 330]))
draw(fill([301,321], [329, 329]), "white")
draw(fill([301,310], [329, 320]), "blue")
draw(fill([301,301], [329, 310]), "red")
'''