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

Web AI should be able to submit multiple actions at once #123

Open
kreibaum opened this issue May 12, 2024 · 0 comments
Open

Web AI should be able to submit multiple actions at once #123

kreibaum opened this issue May 12, 2024 · 0 comments

Comments

@kreibaum
Copy link
Owner

This is relevant when pulling actions out of the opening book. We currently submit moves one by one:

        // TODO: Submit all actions at once, no need to stagger them.
        // Requires changes on Elm side and maybe also in the protocol over websocket.
        for action in &best_move.actions {
            let action = serde_json::to_string(&vec![*action]).map_err(|e| e.to_string())?;
            forwardToMq("aiMoveDetermined", &action);
        }

The Elm limitation is:

        -- TODO: This can't deal with two actions comming in at once!
        AiMoveResponse actions ->
            let
                action =
                    List.head actions |> Maybe.withDefault (Sako.Promote Sako.Queen)
            in
            updateActionInputStep shared action model

And the underlying issue is, that every move needs to be send to the server over websocket.

  • The websocket only accepts moves one at a time.
  • Elm does not guarantee order of Cmd execution.

This means we need to rely on "one by one" for now.

This isn't bad in practice, but it would be nice to clean this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant