-
Notifications
You must be signed in to change notification settings - Fork 16
feat: Implement tic-tac-toe game tournament #11
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
Open
psychemist
wants to merge
24
commits into
LearnWeb3DAO:main
Choose a base branch
from
psychemist:feat/implement-game-tournament
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Implement tic-tac-toe game tournament #11
psychemist
wants to merge
24
commits into
LearnWeb3DAO:main
from
psychemist:feat/implement-game-tournament
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…; calculate player count from prize pool
1. add is-board-full private helper function 2. add logic for resolvig games that end in a tie 3. modify report-game-winner flow to prevent circular dependency
1. add automatic hook for reporting winner of a tournament game 2. handle creating matches in each round programmatically 3. add logic for advancing every tournament bracket 4. pay out STX proze pool to tournament winner
1. add logic to for manually advancing each round after all games are won (only creator) 2. enhance game winner display on frontend
…ac-toe contract post-deployment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tic Tac Toe Game Full Feature Upgrade: Tournament Integration
Summary
A comprehensive tournament upgrade to the tic-tac-toe game system, integrating smart contracts, frontend, and developer tooling for a seamless competitive experience. The changes include new contract logic for creating tournament games, automatic round advancement, robust frontend tournament management, and scripts for deployment and contract setup.
What's New
Smart Contracts
tic_tac_toe_tournament.clar: Added functions for creating, joining, and starting tournaments, automatic bracket advancement, next-round match creation, and improved error handling.tic_tac_toe.clar: Enhanced integrated tournament game logic, winner reporting, and rematch creation for ties.game-tournament-trait.clar: Trait-based contract calls to avoid circular references.Frontend
Scripts & Tooling
setup-tournament.js: Script for setting tournament contract principal post-deployment.Testing & Developer Experience
Key Features
Technical Implementation
Smart Contracts
Frontend
Deployment
ST16*******QXRW88.tic_tac_toedeployments/default.devnet-plan.yaml,deployments/default.simnet-plan.yaml,deployments/default.testnet-plan.yamlTournament Flow Diagram
Step-by-Step Tournament Gameplay Flow:
How to Test
Run Contract Checks
Run Unit & Integration Tests
npm install npm run testDeploy to Devnet
Deploy to Testnet
settings/Testnet.tomlUse Setup Script
.envfileRun Frontend Locally
cd frontend npm install npm run devlocalhost:3000/tournamentson your machine.File-by-File Change Summary
contracts/tic_tac_toe_tournament.clar: Added automatic round advancement, next-round match creation, improved error handling, and trait-based contract calls.contracts/tic_tac_toe.clar: Enhanced tournament game logic, winner reporting, rematch creation for ties, and trait-based contract calls.contracts/game-tournament-trait.clar: Defined trait for tournament-game contract interaction.frontend/lib/tournament-contract.ts: Added contract call functions for tournament creation, joining, starting, round advancement, winner reporting, and bracket management. Integrated caching and error handling.frontend/lib/contract.ts: Updated game creation logic to support tournament context and contract integration.frontend/components/tournament-registration.tsx: Implemented registration UI, entry fee display, and player list. Added logic to prevent joining full tournaments.frontend/components/tournament-bracket.tsx: Built bracket visualization, match navigation, and round status display.frontend/components/tournament-list.tsx: Created tournament list/grid UI, status badges, and navigation to detail pages.frontend/hooks/use-tournaments.ts: Added hooks for tournament state management, contract calls, and polling for updates.frontend/hooks/use-stacks.ts: Improved wallet connection logic, network handling, and contract call integration.frontend/app/tournaments/[tournamentId]/page.tsx: Tournament detail page, bracket visualization, registration, and active match display.frontend/app/tournaments/create/page.tsx: Tournament creation form, input validation, and contract call integration.frontend/app/tournaments/page.tsx: Tournament lobby, listing, and navigation.scripts/setup-tournament.js: Script for setting tournament contract principal post-deployment, .env integration, and improved error handling.deployments/default.devnet-plan.yaml: Deployment plan for Devnet, contract order and addresses.deployments/default.testnet-plan.yaml: Deployment plan for Testnet, contract order and addresses.deployments/default.simnet-plan.yaml: Deployment plan for Simnet, contract order and addresses.Clarinet.toml: Updated contract paths, deployment settings, and environment configuration.