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

Smart Contract for Minigame: Memory Game #62

Open
jimenezz22 opened this issue Jan 22, 2025 · 11 comments · May be fixed by #79
Open

Smart Contract for Minigame: Memory Game #62

jimenezz22 opened this issue Jan 22, 2025 · 11 comments · May be fixed by #79
Assignees
Labels
Dojo Hard Maintainer: Marco Maintainer: Rolo MiniGame ODBoost This issue will be available ONLY during the ODBoost

Comments

@jimenezz22
Copy link
Contributor

Description

This task focuses on creating a smart contract function, validateSequence, using Dojo Engine and Cairo, to verify the correctness of sequences entered by the player in the Memory Game. Additionally, the function should include logic to update the Tamagotchi's intelligence level based on the player's performance in the minigame.

The design of the game mechanics aligns with the frontend implementation outlined in the issue Memory Game Minigame, which describes different concepts and progression systems for memory-based gameplay. This backend logic ensures the minigame's functionality supports the cognitive development of BabyBeasts in an engaging and rewarding manner.


Tasks

Define the validateSequence Function 🧩

  • Create a Cairo function validateSequence with the following parameters:
    • player_id: The ID of the player participating in the minigame.
    • tamagotchi_id: The ID of the Tamagotchi associated with the game.
    • input_sequence: The sequence provided by the player.
    • target_sequence: The correct sequence for the current level.
  • Implement validation logic:
    • Compare the input_sequence with the target_sequence to determine if the player's input matches.
    • Return a boolean (true for correct, false for incorrect) and a score based on accuracy and speed.
  • Store the validation results (e.g., score, success/failure) in an on-chain data structure.

Update Intelligence Logic 📚

  • Create logic to update the Tamagotchi's intelligence level:
    • Assign incremental increases to intelligence for correct sequences.
    • Introduce bonus intelligence points for completing multiple levels without mistakes.
    • Cap intelligence growth to prevent exceeding predefined maximum levels.
  • Align intelligence updates with the minigame's difficulty progression.

Integrate with Dojo Engine ⚙️

  • Leverage Dojo Engine's entity-component system to manage:
    • Player and Tamagotchi data.
    • Sequence progression for each level.
  • Ensure seamless integration with other components of the BabyBeasts ecosystem.

Testing and Validation ✅

  • Write unit tests in Cairo to verify:
    • Sequence validation works for various scenarios, including correct, incorrect, and partially correct inputs.
    • Intelligence updates are accurate and aligned with sequence performance.
  • Perform integration tests to ensure smooth interaction with the frontend game logic.

Deliverables 📂

  • Fully implemented validateSequence function in Cairo.
  • Logic for updating Tamagotchi intelligence based on game performance.
  • A test suite covering validation and intelligence updates.
  • Documentation detailing:
    • Function parameters and return values.
    • Examples of sequence validation and intelligence updates.
    • Description of the progression system and rewards.

Acceptance Criteria 🎯

  • The validateSequence function accurately validates player input and returns results.
  • Tamagotchi intelligence levels are updated correctly based on minigame outcomes.
  • The smart contract implementation aligns with the frontend issue Memory Game Minigame.
  • All tests pass successfully, ensuring a bug-free and seamless integration.

Additional Notes 📝

  • Encourage creativity in designing the sequence progression and intelligence reward system to enhance player engagement.
  • Optimize the contract for efficiency, ensuring low gas costs while maintaining reliability.
  • Collaborate closely with the frontend team to align on sequence difficulty and progression mechanics.
@jimenezz22 jimenezz22 added Dojo Hard Maintainer: Marco ODBoost This issue will be available ONLY during the ODBoost labels Jan 22, 2025
@beeguy74
Copy link

Hi, I am a beginner Cairo developer from Paris.
Closed 3 tasks totally on cairo during previos ODHACK 11.
I don't promise to finish the issue quickly because your project is new to me =)
But I intend to do a decent job and at least do the draft PR within 24 hours.
Could I try solving this?

@EjembiEmmanuel
Copy link

Mind if I try this one? I'm an experienced Cairo developer and I have good knowledge of Dojo.

@RomThpt
Copy link
Contributor

RomThpt commented Jan 22, 2025

I’d love to work on this task and contribute to the project. I’ll be participating in the ETHDenver hackathon, and I see this as a great opportunity not only to help improve the project but also to grow my skills by tackling this issue.

@ShantelPeters
Copy link

Mind if I take this issue?

@Wendyalbert
Copy link

May I be assigned to this?

@aniruddhaaps
Copy link

Hey, I'm a software developer having experience of React and want to contribute to the issue.
To address this issue, I will implement the validateSequence function in Cairo to compare player input with the target sequence, returning validation results and updating on-chain intelligence data for the Tamagotchi. The function will include logic for incremental and bonus intelligence updates, capped at predefined levels, ensuring alignment with the game's progression system. Comprehensive unit and integration testing will validate functionality and seamless frontend integration.

@coxmars
Copy link

coxmars commented Jan 22, 2025

Hi @EjembiEmmanuel this one is yours, if you need help don't hesitate to contact me please 🫡

@EjembiEmmanuel
Copy link

Hi @EjembiEmmanuel this one is yours, if you need help don't hesitate to contact me please 🫡

Sure, thank you!

@coxmars
Copy link

coxmars commented Jan 27, 2025

Hi @EjembiEmmanuel, do you have updates? or do you need help?

@beeguy74
Copy link

beeguy74 commented Jan 27, 2025

If there is no updates, i am still interested to crash this task for you =)

@EjembiEmmanuel
Copy link

Hi @EjembiEmmanuel, do you have updates? or do you need help?

Hi @coxmars I'll create a PR today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dojo Hard Maintainer: Marco Maintainer: Rolo MiniGame ODBoost This issue will be available ONLY during the ODBoost
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants