2023-04-19 18:27:13 +00:00
|
|
|
import requests
|
|
|
|
from time import sleep
|
2023-04-21 09:55:30 +00:00
|
|
|
from tqdm import tqdm
|
2023-04-19 18:27:13 +00:00
|
|
|
|
2023-04-21 13:06:24 +00:00
|
|
|
global xc, yc
|
|
|
|
xc = 0 ; yc = 0
|
|
|
|
|
2023-04-21 12:41:35 +00:00
|
|
|
def draw(cords, color = "black"):
|
2023-04-21 13:06:24 +00:00
|
|
|
global xc, yc
|
2023-04-21 09:55:30 +00:00
|
|
|
for i in tqdm(range(len(cords))):
|
2023-04-21 13:06:24 +00:00
|
|
|
payload = {'x': cords[i][1] + yc, 'y': cords[i][0] + xc, 'color': color }
|
2023-04-20 12:25:46 +00:00
|
|
|
|
2023-04-19 18:27:13 +00:00
|
|
|
response = requests.post('http://pb.dmcraft.online', data=payload)
|
2023-04-20 12:25:46 +00:00
|
|
|
|
|
|
|
while str(response) != "<Response [200]>":
|
|
|
|
response = requests.post('http://pb.dmcraft.online', data=payload)
|
2023-04-21 09:55:30 +00:00
|
|
|
print("Error, retrying...")
|
2023-04-21 12:41:35 +00:00
|
|
|
sleep(0.1)
|
2023-04-20 12:31:25 +00:00
|
|
|
print("DONE!")
|
2023-04-19 18:27:13 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-04-21 09:55:30 +00:00
|
|
|
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
|
2023-04-19 18:27:13 +00:00
|
|
|
|
2023-04-20 12:25:46 +00:00
|
|
|
|
2023-04-19 18:27:13 +00:00
|
|
|
|
2023-04-21 13:06:24 +00:00
|
|
|
|
|
|
|
xc = 200
|
|
|
|
yc = 300
|
|
|
|
|
|
|
|
#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")
|
|
|
|
|