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

Create a card-game Aztec noir example #1463

Closed
LeilaWang opened this issue Aug 8, 2023 · 1 comment · Fixed by #2135
Closed

Create a card-game Aztec noir example #1463

LeilaWang opened this issue Aug 8, 2023 · 1 comment · Fixed by #2135
Assignees

Comments

@LeilaWang
Copy link
Collaborator

LeilaWang commented Aug 8, 2023

Finish the card game, specifically the following logic should be done:

Parameters for now:

NUMBER_OF_PLAYERS=2
NUMBER_OF_CARDS_DECK=2
NUMBER_OF_CARDS_PACK=2

Asynchronously, people buy_pack to get all the latest chase CGAM cards. CGAM cards have a random strength and a random points. Strength is good, it helps you win. Points are bad, they give your opponent points. These are both independently random variables.

At some point, when they have at least NUMBER_OF_CARDS_DECK, they can join_game().
When they join_game(), we want to take stock of their total deck strength while not revealing their cards. The person with the highest total deck strength will go last. (Note there's a flaw here as the first person to queue a public call is at a disadvantage, we're just ignoring this, could have an extra phase later)

Once NUMBER_OF_PLAYERS has been reached, the game starts. The players move in turn order calling play_card (can hardcode this for 2 players for now) based on their deck strength. Once you see their action, you reveal a card in your deck and presumably try to beat their strength. The person who wins the round gets the number of points. Once we have NUMBER_OF_CARDS_DECK rounds, we see which person has the most points, and declare them the winner. All cards in both decks are given to the winner.

Entry points:
private buy_pack: A person is able to buy a random pack privately. They get NUMBER_OF_CARDS_PACK cards inserted into their private NFT collection.

  • Simplification: The randomness source is trusted from the user, provided as a seed.
  • Simplification: No money is involved.

private queue_join_game: Signal privately intent to join a specified game, computing the deck strength and commiting to the deck

  • Simplification: Game id is arbitrary and users just agree on one to all join.

public internal join_game: Join a specified game, committing to their decks and deck strength and modifying game data structures that set up for start_game to identify all players and their decks.

public internal start_game: Start a specified game, creating structures necessary to keep track of who's turn it is, who is in the game, and how many points they currently have.

public play_card: For a specific game if it is your turn, reveal a card from your deck, proving you own it, and nullify it. If you are the last person in a round, resolve that round based on who has the highest strength card. You then get the sum of points of all the other cards.

public end_game: Once NUMBER_OF_CARDS_DECK rounds have passed, mint all played cards from opponents to the winner (they have been nullified at this point).

We want a test with 2 players and 2 card decks that play 2 rounds in the game, and successfully have the winner then play a new opponent with his minted cards.

@ludamad
Copy link
Collaborator

ludamad commented Aug 25, 2023

This one's not getting done by our deadline likely. The card game logic proved labour intensive to test, and I probably switched to it too late. I would simplify it to some e.g. high card game, but is that sufficiently different from the other examples? I could probably finish it with a few days.

@iAmMichaelConnor iAmMichaelConnor modified the milestones: 🚀 Initial Aztec Sandbox Release, 📢 Initial Public Sandbox Release Aug 25, 2023
@ludamad ludamad assigned sirasistant and unassigned ludamad Sep 5, 2023
@ludamad ludamad changed the title Finish offsite card game example. Create a card-game Aztec noir example Sep 5, 2023
sirasistant added a commit that referenced this issue Sep 8, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in A3 Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants