New beta. Remove pack() in extras (no longer needed)
This commit is contained in:
parent
3bf33f9d30
commit
edcaf98b42
@ -2,19 +2,17 @@ from listwork import *
|
||||
from random import randint as ri
|
||||
|
||||
# pas2( fill(...) ) -> 1/2
|
||||
def pas2(packed):
|
||||
unpacked = unpack(packed["main"])
|
||||
def pas2(pxls):
|
||||
new_pxls = []
|
||||
|
||||
pas = False
|
||||
for i in unpacked:
|
||||
for i in pxls:
|
||||
if not pas:
|
||||
new_pxls.append(i)
|
||||
pas = True
|
||||
else:
|
||||
pas = False
|
||||
packed = {"main": pack(new_pxls)}
|
||||
return packed
|
||||
return new_pxls
|
||||
|
||||
# rand(x1,y1, x2,y2) -> draw() or pas2()
|
||||
def rand(x1,y1, x2,y2):
|
||||
@ -22,5 +20,4 @@ def rand(x1,y1, x2,y2):
|
||||
for x in range(x1, x2 +1):
|
||||
for y in range(y1, y2 +1):
|
||||
pxls.append([x,y, ri(0,255), ri(0,255), ri(0,255)])
|
||||
packed = {"main": pack(pxls)}
|
||||
return packed
|
||||
return pxls
|
||||
|
12
botv2.py
12
botv2.py
@ -1,4 +1,6 @@
|
||||
import requests
|
||||
from time import sleep
|
||||
# Progress-bar
|
||||
from tqdm import tqdm
|
||||
# Work with list-like objects
|
||||
from listwork import *
|
||||
@ -22,6 +24,7 @@ def fill(x1,y1, x2,y2, color):
|
||||
# draw( fill(...) )
|
||||
def draw(pxls):
|
||||
global server
|
||||
ic(pxls)
|
||||
|
||||
push = [] # Push %limit% items
|
||||
limit = 300
|
||||
@ -34,11 +37,13 @@ def draw(pxls):
|
||||
push.append({"main": pack(packs)})
|
||||
push.append({"main": pack(pxls)}) # Pack last
|
||||
|
||||
ic(push)
|
||||
for i in tqdm(push):
|
||||
response = requests.post(server, i)
|
||||
while not response.status_code == 200:
|
||||
print("Error, retrying...")
|
||||
response = requests.post(server, i)
|
||||
sleep(0.1)
|
||||
|
||||
# cfill(0,0, 10,10)
|
||||
def cfill(x1,y1, x2,y2):
|
||||
@ -57,10 +62,11 @@ def ccheck(packed):
|
||||
return out
|
||||
|
||||
from random import randint as ri
|
||||
draw( fill(0,0, 100,100, [ri(0,255),ri(0,255),ri(0,255)]) )
|
||||
#draw( fill(0,0, 100,100, [ri(0,255),ri(0,255),ri(0,255)]) )
|
||||
#draw( [[0,0, 100,100, 255,255,255]] )
|
||||
|
||||
#print(ccheck(pack([[0,0]]) ))
|
||||
#print(ccheck(cfill(0,0, 10,10)))
|
||||
|
||||
#from bot_extras import *
|
||||
#print( draw(pas2( rand(0,0, 100,100) )) )
|
||||
from bot_extras import *
|
||||
draw(pas2( rand(0,0, 100,100) ))
|
||||
|
Loading…
Reference in New Issue
Block a user