A web application for collecting bidding data for the Indian card game "28".
- User Management: 6 concurrent users (Amit, Veronica, Ritika, Babu, Vinu, Others)
- Pool System: 6 pools of ~377 hands each (2,262 total unique canonical hands)
- Dynamic Assignment: Pools dynamically assigned based on availability
- Suit Isomorphism: Canonical hand representation reduces state space
- Back Button: Ability to go back and modify previous submission
- Inactivity Timeout: 5-minute session timeout with pool release
- Duplicate Handling: Automatic skipping of already-submitted hands
- Real-time Validation: Pool assignment checks every 30 seconds
- Frontend: Next.js 14 (App Router), React, TypeScript, Tailwind CSS
- Backend: Next.js API Routes
- Database: PostgreSQL
- Deployment: Vercel
- Node.js 18+
- PostgreSQL 14+
- Python 3.8+ (for preprocessing)
-
Clone the repository
-
Install dependencies:
npm install pip install psycopg2-binary
-
Create PostgreSQL database:
createdb card_game_28 psql -d card_game_28 -f schema.sql
-
Populate database:
python lib/preprocess.py
-
Configure environment:
cp .env.example .env.local # Edit .env.local with your database URL -
Run development server:
npm run dev
- pools: Tracks pool assignments and activity
- pool_hands: Pre-populated hands for each pool
- submissions: User bid submissions
- Unique constraint on
canonical_keyin submissions - 5-minute inactivity timeout enforced
- Row-level locking for concurrent pool assignment
POST /api/assign-pool- Assign pool to userGET /api/get-hand- Fetch current handPOST /api/submit-bid- Submit trump card and bidPOST /api/go-back- Navigate to previous handPOST /api/release-pool- Release pool on timeoutGET /api/check-activity- Verify session validity
- Push to GitHub
- Import project in Vercel
- Add Vercel Postgres database
- Run preprocessing script with Vercel database URL
- Deploy
- 32-card deck (7, 8, 9, 10, J, Q, K, A in 4 suits)
- Users select trump card from their 4-card hand
- Users bid between 14-20 points
- Rank order: J > 9 > A > 10 > K > Q > 8 > 7
- Collect optimal bidding strategies for each canonical hand
- Compare bidding patterns across different players
- Build training data for AI bot development
MIT