with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((SIM_IP, SIM_PORT + PARALLEL_PARAM))
s.send('state'.encode('utf-8'))
observation = json.loads(s.recv(MESSAGE_SIZE).decode('utf-8'))
…
def step(self, action): #1ターン進めるために呼び出す
…
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((SIM_IP, SIM_PORT + PARALLEL_PARAM))
s.send(json.dumps({'action': action}).encode('utf-8')
…