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

Allowing "fair" fights #250

Open
edeandrea opened this issue Mar 8, 2023 · 3 comments
Open

Allowing "fair" fights #250

edeandrea opened this issue Mar 8, 2023 · 3 comments
Labels
enhancement New feature or request fights-service Fights service heroes-service Heroes service ui UI app villains-service Villains service

Comments

@edeandrea
Copy link
Collaborator

edeandrea commented Mar 8, 2023

While requesting random fights is great, what if we introduced a "fairness" setting in the UI. Sometimes we get fights that don't seem fair, where one fighter is a level 10 and the other is 10,000,000.

We could have a dropdown/radio button/whatever that, when selected in the UI, gave a choice to the user. Something like

  • Weaklings
  • Average
  • Super strong
  • Super-duper strong

We can certainly come up with better names/categories, but whatever we come up with we'd assign ranges of fighter levels to each term. The weakling would be anything <= some number and the Super-duper strong would be anything >= some number.

We'd pass that on the getRandomFighters call to rest-fights, which would in turn pass to the rest-heroes & rest-villains. rest-heroes & rest-villains would guarantee that only a fighter between those levels would be returned.

We could use this scenario to really showcase consumer-driven contract testing where making sure rules within the contract between consumers & producers stipulates the requirement in the contract.

So for example, in the rest-fights consumer contract you'd have something in the contract that said

When I (the rest-fights consumer requests a random hero/villain between a certain level, the level attribute in the response from the rest-heroes/rest-villains service should be between the values passed in the request.

Thats the kind of thing that can't be done using straight OpenAPI.

@edeandrea edeandrea added enhancement New feature or request fights-service Fights service villains-service Villains service heroes-service Heroes service ui UI app labels Mar 8, 2023
@edeandrea
Copy link
Collaborator Author

@cescoffier / @agoncal / @holly-cummins thoughts?

@cescoffier
Copy link
Member

In my importer/exporter I filter out these giants. But yes, we could imagine adding a parameter.

Another thing I discussed with @agoncal 🐰 a long time ago is to introduce 'universe', and having dedicated hero and villain services. The goal is to illustrate Stork.

@holly-cummins
Copy link
Collaborator

+1 from me. :)

I see two options for how we control it in the UI:

  • A user-controlled mechanism, like a dropdown/radio-button/etc
  • A ratchet, where each successive fight ups the complexity (and a page reload drops it back down to 'weakling')

I guess the implementation complexity is similar for each, apart from a bit of extra UI work for the user-control. The user-control may need less explanation when we show it, which would be a good thing - but if we're in a hurry, we could start with the ratchet.

(I like the universe idea, too, although in the short term it doesn't help my and Eric's demo. :) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fights-service Fights service heroes-service Heroes service ui UI app villains-service Villains service
Projects
None yet
Development

No branches or pull requests

3 participants