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.
47 lines
704 B
47 lines
704 B
#!/usr/bin/env python3 |
|
|
|
import socket |
|
import random |
|
|
|
IP_ADDRESS = "2001:638:904:ffc9::2" |
|
PORT = 1234 |
|
|
|
W = 1920 |
|
H = 1080 |
|
|
|
s_w = 10 |
|
s_c = "FFC0CB" |
|
|
|
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) |
|
s.connect((IP_ADDRESS, PORT)) |
|
|
|
x = W//2 |
|
y = H//2 |
|
d = 0 |
|
c = 0 |
|
|
|
while True: |
|
if x > W or x < 0 or y > H or y < 0: |
|
x = W//2 |
|
y = H//2 |
|
|
|
if c >= 0: |
|
d = (d+random.randint(-1,1)) % 4 |
|
c = random.randint(0, 10) |
|
|
|
if d == 0: |
|
x += 0 |
|
y += -1 |
|
elif d == 1: |
|
x += 1 |
|
y += 0 |
|
elif d == 2: |
|
x += 0 |
|
y += 1 |
|
elif d == 3: |
|
x += -1 |
|
y += 0 |
|
|
|
s.send("PX {} {} {}\n".format(x,y, s_c).encode("utf-8")) |
|
|
|
c += 1
|
|
|