added error handling, random input etc
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
import random
|
||||
import socket
|
||||
|
||||
SERVER_IP = "127.0.0.1"
|
||||
PORT = 5901
|
||||
|
||||
input = random.randint(1, 1000)
|
||||
|
||||
# Manually set the starting "input" for the first team
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((SERVER_IP, PORT))
|
||||
# Using "0" as the ID for the very first team's source
|
||||
s.send("ADMIN SET 0 80".encode()) # Sets the first clue as 80
|
||||
s.send(f"ADMIN SET 0 {input}".encode()) # Sets the first clue as 80
|
||||
print(f"Input of {input} Set")
|
||||
print(s.recv(1024).decode())
|
||||
s.close()
|
||||
|
||||
@@ -12,7 +12,7 @@ while True:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((SERVER_IP, PORT))
|
||||
s.send(f"GET {PREV_ID}".encode())
|
||||
input = s.recv(1024).decode().strip()
|
||||
input = s.recv(1024).decode().strip() # Clue is called input in the code
|
||||
s.close()
|
||||
|
||||
if input != "-1": # -1 Means Clue Is Not Yet Sent
|
||||
|
||||
Reference in New Issue
Block a user