Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MatPlotPong #33

Open
jerpint opened this issue Aug 21, 2024 · 4 comments
Open

MatPlotPong #33

jerpint opened this issue Aug 21, 2024 · 4 comments

Comments

@jerpint
Copy link

jerpint commented Aug 21, 2024

I implemented a simple MatPlotPong, for now it's only single-player. Uses hotkeys for moving the paddles

see: https://x.com/jerpint/status/1826088979973755308
gist: https://gist.github.com/jerpint/07515420078949f7358fab7e1319e5c0

@Isaac-Flath
Copy link
Collaborator

Isaac-Flath commented Aug 21, 2024

Check the list of things I want to think about for adding this. If you want to tackle any that's awesome! Not sure how soon it'll be before I get to all these.

  • State: Either front-end or backend by session so different users games don't interfere with each other
  • Win action: Simplest would be an alert.
  • UI cleanup: Remove axis numeric ticks
  • Refactor a few things:

@jerpint
Copy link
Author

jerpint commented Aug 22, 2024

I added in the same gist:

  • Win action: Displays every time there's a point scored
  • Game Pause/Restart support
  • Reorganized the code so fasthtml section is standalone

I'm not super familiar with websockets and how to handle state, but will attempt to figure it out

still missing:

  • State: Either front-end or backend by session so different users games don't interfere with each other
  • Make concise info page, like TicTacToe one

Possibly useful too:

  • Make display of commands prettier

@Isaac-Flath
Copy link
Collaborator

Isaac-Flath commented Aug 22, 2024

@jerpint - If you're up for an experiment that I think will work and would be super simple, we could try storing it in the session. If that doesn't work I can point you in the right direction on state!

@app.get('/whatever_route')
def whatever_func(sess):
    sess['pong_state'] = sethatever dict/list/stuff you need
    
@app.get('/another_route')
def another_func(sess):
    current_state = sess['pong_state']

@Isaac-Flath
Copy link
Collaborator

Also, I will also want to take new small pieces to add to the gallery. For example, a minimal hotkey example under dynamic user interface that the info page of this can link to :)

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

No branches or pull requests

2 participants