|
|
|
@ -7,6 +7,7 @@ from listwork import *
|
|
|
|
|
|
|
|
|
|
# Easy debug
|
|
|
|
|
from icecream import ic
|
|
|
|
|
ic.disable() # Disable debug
|
|
|
|
|
|
|
|
|
|
global server
|
|
|
|
|
#server = 'http://127.0.0.1:3333'
|
|
|
|
@ -45,7 +46,7 @@ def draw(pxls):
|
|
|
|
|
response = requests.post(server, i)
|
|
|
|
|
sleep(0.1)
|
|
|
|
|
|
|
|
|
|
# cfill(0,0, 10,10)
|
|
|
|
|
# cfill(0,0, 10,10) // Limit - 34x34
|
|
|
|
|
def cfill(x1,y1, x2,y2):
|
|
|
|
|
pxls = []
|
|
|
|
|
for x in range(x1, x2+1):
|
|
|
|
@ -58,15 +59,21 @@ def cfill(x1,y1, x2,y2):
|
|
|
|
|
def ccheck(packed):
|
|
|
|
|
global server
|
|
|
|
|
response = requests.get(f'{server}/get_color={packed}')
|
|
|
|
|
ic(response.text)
|
|
|
|
|
out = unpack(response.text)
|
|
|
|
|
return out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### EXAMPLE
|
|
|
|
|
# Draw random square 100x100 on 0,0
|
|
|
|
|
from random import randint as ri
|
|
|
|
|
#draw( fill(0,0, 100,100, [ri(0,255),ri(0,255),ri(0,255)]) )
|
|
|
|
|
#draw( [[0,0, 100,100, 255,255,255]] )
|
|
|
|
|
draw( fill(0,0, 100,100, [ri(0,255),ri(0,255),ri(0,255)]) )
|
|
|
|
|
|
|
|
|
|
#print(ccheck(pack([[0,0]]) ))
|
|
|
|
|
#print(ccheck(cfill(0,0, 10,10)))
|
|
|
|
|
# Check square 34x34 on 0,0
|
|
|
|
|
print(ccheck(cfill(0,0, 34,34)))
|
|
|
|
|
|
|
|
|
|
# Use extras, draw 1/2 random square 100x100 on 0,0
|
|
|
|
|
from bot_extras import *
|
|
|
|
|
draw(pas2( rand(0,0, 100,100) ))
|
|
|
|
|