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

Add support for predicting opponent orders #20

Merged
merged 11 commits into from
Dec 18, 2024
Merged

Conversation

aphedges
Copy link
Contributor

@aphedges aphedges commented Dec 13, 2024

This PR adds client support for a new suggestion type that predicts the orders of opponents. This change required another refactor of the suggestion format, but the previous refactors made it significantly easier this time! I also made some related improvements to the suggestion code and added a test implementation to RandomProposerAdvisor.

For the library and UI implementations, see ALLAN-DIP/diplomacy#34. For the CICERO implementation, see ALLAN-DIP/diplomacy_cicero#32.

I accidentally used overly strict typing when I created this method.
When I copied `suggest_message()` to create `suggest_commentary()`, I
forgot to change the reference to the original function's name in the
error message.
This further abstracts away the message format of suggestions and makes
a later change easier.
The first JSON format was designed to allow easy filtering by the
intended recipient, but it assumed that a player would only receive
advice about themselves. It was unable to handle move advice about other
players, which we intend to support, so I needed to redesign the format
to allow it.

The new format has an explicit `recipient` field to avoid accidentally
intercepting any suggestions intended for another player. In addition,
it can handle other top-level metadata that we want to store, such as
the advisor that sent the suggestion.
Although the player will not see this value, we want this available in
the logs for evaluation.
This will be used by CICERO to send predicted orders to the Llama
advisor.
All bots should declare what suggestion types they support in
`BaselineBot.suggestion_type`, and that value is needed so the UI
displays the sent suggestions.

We should raise an exception to prevent a bot from accidentally sending
suggestions that the user would never see when the suggestion support is
not explicitly declared.
We now test the new `BaselineBot.suggest_opponent_orders()` method in
`RandomProposerAdvisor`.
@aphedges aphedges merged commit 96489b5 into main Dec 18, 2024
2 checks passed
@aphedges aphedges deleted the predict-opponent-orders branch December 18, 2024 20:51
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