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

Dynamically inject randomness #293

Open
Zomis opened this issue Feb 16, 2022 · 2 comments
Open

Dynamically inject randomness #293

Zomis opened this issue Feb 16, 2022 · 2 comments
Labels
dsl-core For improvements of the DSL approach to defining games enhancement New feature or request refactor Improvements to the code quality, not directly to existing functionality server-core

Comments

@Zomis
Copy link
Owner

Zomis commented Feb 16, 2022

When a game checks for saved randomness-state, it would be useful if while playing one could inject what one would want the value to be.

Something like the following:

  • Game asks replayable for randomness-state, none is found
  • Randomness calls the provided lambda to get a value but does not instantly return it to the game
  • Randomness calls some user interaction or something that shows the result of the provided lambda and asks for what the value should be
  • User interaction may either provide a manual value or choose to "pick another" which will call the provided lambda again and return a new response
@Zomis Zomis added enhancement New feature or request server-core dsl-core For improvements of the DSL approach to defining games labels Feb 16, 2022
@Zomis
Copy link
Owner Author

Zomis commented Jun 22, 2022

This would require that the methods in replayable be made into suspending functions, which would cascade through all games that are currently using randomness and throughout many places in the internal codebase.

I feel like it can be interesting to keep in mind, but not worth the effort right now.

@Zomis Zomis added the refactor Improvements to the code quality, not directly to existing functionality label Jun 22, 2022
@Zomis
Copy link
Owner Author

Zomis commented Jan 11, 2023

A possible way to solve this would be to add a loop like this:

  • Make a move, create some randomness (e.g. cards: 'a', 'b', 'c', 'd'. dice: 4 + 6)
  • Ask which randomnesses you'd like to keep. (cards and/or dice with the above example)
  • Remove the move and replay the rest of the game, then make the same action again. You will get new randomness

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dsl-core For improvements of the DSL approach to defining games enhancement New feature or request refactor Improvements to the code quality, not directly to existing functionality server-core
Projects
None yet
Development

No branches or pull requests

1 participant