Skip to content

Create a tournament PoC model #93

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

Closed
coxmars opened this issue Nov 20, 2024 · 11 comments · Fixed by #96
Closed

Create a tournament PoC model #93

coxmars opened this issue Nov 20, 2024 · 11 comments · Fixed by #96
Assignees
Labels
external-contributor Available for external contributors good first issue Good for newcomers ODHack10

Comments

@coxmars
Copy link
Contributor

coxmars commented Nov 20, 2024

Create a tournament.cairo PoC model to manage in-game tournaments dynamically, allowing structured player competitions.

You can think about these fields, feel free to change, delete, or modify them according to our current backend structure:

  • tournament_id: Unique ID for the tournament.
  • name: Name of the tournament.
  • status: Status of the tournament (e.g., pending, ongoing, completed). You can create an enum.
  • entry_fee: Optional cost for players to enter the tournament.
  • max_participants: Maximum number of participants allowed.
  • Dynamic arrays (using Alexandria library): https://github.com/keep-starknet-strange/alexandria
    • current_participants: List of player IDs participating in the tournament.
    • prize_pool: List of rewards (e.g., items, currency).

Feel free to implement the following core functions:

  • create_tournament: Create a new tournament with specified attributes.
  • register_player: Register a player in the tournament if it is pending and not full.
  • start_tournament: Mark the tournament as ongoing and validate the conditions for starting.
  • complete_tournament: Finalize the tournament, declare the winner, and distribute rewards.
  • get_tournament: Retrieve details of a specific tournament, including participants and status.

You are encouraged to add any additional functions or operations you believe are necessary to improve the model's functionality or better integrate it into the game.

Thanks for your time, please send a comment with your approach/solution, be creative and use a technical explanation and avoid ChatGPT or AI comments.

@remybar
Copy link

remybar commented Nov 21, 2024

Hi @coxmars !

I would be interested in creating a first version of tournament management in your backend.

About my approach, I would start with a simple but extensible tournament structure based on what you described in this issue (and probably what has been done on the Arcane repo). For example, I would use an enum for prizes, to first manage prizes in ERC20 tokens but be able to add other kinds of prizes such as NFTs in a second time.
In a first time, I can propose you a list of models and systems to be implemented, just to validate the approach, and then implement them.

I'm used to contribute on OnlyDust projects (see my OD profile) and I mainly contribute on Dojo core and sozo since beginning of this year, so I have a good knowledge of Dojo core. I'm also very active on the NodeGuardians platform (my profile).

@Gerson2102
Copy link
Contributor


Hey! I'm Gerson. 👋

I'm a member of Dojo Coding and have previously contributed to other projects like:

  • kakarot-rpc
  • kakarot-ssj
  • ef-tests
  • Madara
  • Raito
  • Starknet-Phone

I'd like to work on this issue.

Check my OnlyDust profile for my contributions: Profile


Plan to Solve the Issue:

  1. Design the Tournament Model:

    • Define fields like tournament_id, name, status (using an enum), entry_fee, max_participants, current_participants (using Alexandria library for dynamic arrays), and prize_pool.
    • Adjust or modify fields as needed to fit the current backend structure.
  2. Implement Core Functions in tournament.cairo:

    • create_tournament: Create new tournaments with specified attributes.
    • register_player: Register players if the tournament is pending and not full.
    • start_tournament: Change the status to ongoing after validating conditions.
    • complete_tournament: Finalize the tournament, declare winners, and distribute rewards.
    • get_tournament: Retrieve tournament details, including participants and status.
  3. Integrate Dynamic Arrays:

    • Use the Alexandria library for managing dynamic arrays for participants and prize pools.
  4. Documentation:

    • Comment the code thoroughly.
    • Update any relevant documentation to explain the new model and functions.
  5. Commit Changes with a clear message

  6. Open a Pull Request and await feedback.


@ShantelPeters
Copy link

Could I grab this task?

@coxmars
Copy link
Contributor Author

coxmars commented Nov 21, 2024

Hi @coxmars !

I would be interested in creating a first version of tournament management in your backend.

About my approach, I would start with a simple but extensible tournament structure based on what you described in this issue (and probably what has been done on the Arcane repo). For example, I would use an enum for prizes, to first manage prizes in ERC20 tokens but be able to add other kinds of prizes such as NFTs in a second time. In a first time, I can propose you a list of models and systems to be implemented, just to validate the approach, and then implement them.

I'm used to contribute on OnlyDust projects (see my OD profile) and I mainly contribute on Dojo core and sozo since beginning of this year, so I have a good knowledge of Dojo core. I'm also very active on the NodeGuardians platform (my profile).

Hi @remybar, your experience is great but for this one I will choose @Gerson2102, are you interested in the related issue (unit tests for tournament) or another one of your interest?

@baitcode
Copy link

Background: extensive web 2.0
I'm a Cairo developer with passion for gaming would love to contribute. I would really appreciate the opportunity as I've been looking through dojo code and want to get more experience with this framework.

@remybar
Copy link

remybar commented Nov 21, 2024

Hi @remybar, your experience is great but for this one I will choose @Gerson2102, are you interested in the related issue (unit tests for tournament) or another one of your interest?

Ok, thanks for your answer.
For me, unit tests are a tool to be used by the developer himself to write his code and validate it step by step (TDD or kind of). So, for me, it makes no sense to ask to another dev to write unit tests of a feature. It would make more sense for me to ask to someone else to write functional tests about a feature which is already defined (fixed interface + behaviour of this interface).

@JoE11-y
Copy link

JoE11-y commented Nov 21, 2024

I'd be happy to do this.

@coxmars
Copy link
Contributor Author

coxmars commented Nov 21, 2024

Hi @remybar, your experience is great but for this one I will choose @Gerson2102, are you interested in the related issue (unit tests for tournament) or another one of your interest?

Ok, thanks for your answer. For me, unit tests are a tool to be used by the developer himself to write his code and validate it step by step (TDD or kind of). So, for me, it makes no sense to ask to another dev to write unit tests of a feature. It would make more sense for me to ask to someone else to write functional tests about a feature which is already defined (fixed interface + behaviour of this interface).

I agree in part, but at enterprise level many times the features/flow are created first and even after unit tests are implemented and many times by different devs, I'm not saying it's right but it's part of, anyway if any other issue is interested is more than welcome.

@remybar
Copy link

remybar commented Nov 21, 2024

Yes, I fully understand your point, I've seen that during almost 20 years in the companies I worked for ^^
But as I consider this as a bad practice, I prefer avoid doing this when I can :)

All the issues have already been assigned, so next time for me 👍

@coxmars
Copy link
Contributor Author

coxmars commented Nov 21, 2024

Yes, I fully understand your point, I've seen that during almost 20 years in the companies I worked for ^^ But as I consider this as a bad practice, I prefer avoid doing this when I can :)

All the issues have already been assigned, so next time for me 👍

Awesome experience and for sure we would like to have you here in the future, thanks 🫡

@AlakaTahir
Copy link

AlakaTahir commented Nov 24, 2024

Hello, I would love to apply for related task like this (if any). I am new here, but I have good knowledge on designing and developing applications.

@github-project-automation github-project-automation bot moved this from TODO 🥷 to Done in ByteBeasts - External Board Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-contributor Available for external contributors good first issue Good for newcomers ODHack10
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants