From 41f70c6cf2c14be1e1acba740bfb9aecf93486fb Mon Sep 17 00:00:00 2001 From: none Date: Sat, 25 Nov 2023 13:14:22 +0300 Subject: [PATCH] Stable version --- botv2.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/botv2.py b/botv2.py index f9ed783..34ed5fa 100644 --- a/botv2.py +++ b/botv2.py @@ -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) ))