Skip to content

update polite ping pong with new protocol#285

Merged
dieriver merged 3 commits intoSoftwareQuTech:release4.0.0-new_sdkfrom
spoukke:chore/spoukke/update-polite-ping-pong
Mar 23, 2026
Merged

update polite ping pong with new protocol#285
dieriver merged 3 commits intoSoftwareQuTech:release4.0.0-new_sdkfrom
spoukke:chore/spoukke/update-polite-ping-pong

Conversation

@spoukke
Copy link
Copy Markdown
Contributor

@spoukke spoukke commented Mar 23, 2026

This MR updates polite ping pong example with new protocol implementation.

print(f"Alice [{state}]: connection dropped unexpectedly.")
break
msg = data.decode("utf-8")
msg = data.decode().strip()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite UTF-8 decoding is implicit, I would still make it explicit, for teaching purposes

rounds_left = NUM_ROUNDS

# ── Event loop ────────────────────────────────────────────────────────────────
async def handle_ready(writer: StreamWriter) -> str:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite technically possible, I would not define these functions nested; it makes the code of run_alice much longer than needed. Being this said, I would move the functions (and the dispatcher declaration) to the outside scope.
To do this, you might need to declare rounds_left in that scope, and declare it as "global" inside the bodies of the functions that use that var.,

@dieriver dieriver merged commit dd8c23f into SoftwareQuTech:release4.0.0-new_sdk Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants