start = datetime.now()
        s.sendall(b"INIT: " + bytes(str(env) + "\n", 'ascii'))
        res = s.recv(8).decode("ascii").strip()
        if res != "DONE":
            print("Wrong answer from the server")
            s.sendall(b"END")
            exit(1)
        end = datetime.now()

        if (end - start).total_seconds() > initLimit:
            print("Init timeout")
            s.sendall(b"END")
            exit(1)

        while not sim.isTerminated():
            sensor = sim.getSensorValues()

            start = datetime.now()
            if GPS_ONLY:
                s.sendall(b'STEP: ' + bytes(str(pos) + "\n", "ascii"))
            else:
                s.sendall(b'STEP: ' + bytes(str(sensor) + "\n", "ascii"))
            result = Instruction(int(s.recv(2).decode('ascii').strip()))
            end = datetime.now()

            if (end - start).total_seconds() > instructionLimit:
                print("Instruction timeout")
                s.sendall(b"END")
                exit(1)

            if type(result) == tuple: