Hand Cricket
U play cricket, It plays u .
The problem Hand Cricket solves
Project Value Proposition
- Touchless Interactive Gaming: Play Hand Cricket using natural hand gestures via webcam, eliminating physical controllers for a hygienic, hardware-free experience.
- Smarter Adaptive AI: The engine learns player patterns in real time, actively avoiding bowler traps and spammed numbers to give an unpredictable, human-like challenge.
- Zero-Setup Adaptation: Adapts on the fly during gameplay without requiring manual offline retraining or dataset preparation.
- ML Testbed & Telemetry: Serves as an open diagnostic blueprint for developers to observe, test, and refine online Bayesian learning algorithms.
Our Theory:
We use Bayesian models, probabilistic learning models, and Markov chains—techniques often used in quant-related fields—to understand human subconscious patterns. These are relevant to areas such as poker, financial market trends, and games like hand cricket. After all, stock market trends are a consequence of collective human emotions and subconscious buy-and-sell decisions.
Technical Architecture
PART 1: Gesture Recognition & Input Pipeline
- 3D Hand Tracking: Utilizes MediaPipe Hands to extract 21 spatial
(x, y, z)landmarks per detected hand at low latency (< 15 ms). - Dual-Hand Mapping (1 to 10): Single-hand tracking for values 1 to 5; dual-hand spatial bounding-box tracking for 6 to 10.
- Geometric Invariance: Normalizes landmark coordinates against palm centers and wrist axes, rendering gesture detection invariant to camera distance, tilt, or hand rotation.
- Joint Mechanics Classification: Calculates vector dot-product angles across Metacarpophalangeal (MCP), Proximal Interphalangeal (PIP), and Distal Interphalangeal (DIP) joints to classify finger flexion and extension.
- Temporal Consensus & Latching: Implements a 5-frame sliding window consensus filter (
Confidence ≥ 0.85) combined with wrist velocity thresholding (Δv_wrist < ε) to eliminate double-triggering during throwing gestures.
PART 2: The Learning Engine & Strategy Variations
A. Online Bayesian Multi-Model Ensemble (MovePredictor)
Learns dynamically during gameplay without offline pre-training by running 10 parallel sub-models:
- Uniform Baseline: Non-informative prior
P(m) = 1/K. - Global Frequency: Dirichlet/Laplace smoothed baseline frequency tracking (
α = 1.0). - Exponential Recency: Decayed frequency tracking with exponential half-life (
γ = 0.5^(1/τ)). - Role-Dependent Conditional: Tracks probability distribution shifts between human batting vs. bowling.
- Situation-Dependent Bucketing: Conditions choice distributions on target score deficit (close, mid, far).
- 1st-Order Markov Chain: Sequential transition probability
P(m_t | m_{t-1}). - 2nd-Order Markov Chain: High-order sequence transition
P(m_t | m_{t-1}, m_{t-2}). - Opponent Reaction Model: Evaluates human choices based on the AI's prior move.
- Delta Transition Model: Tracks modulo step shifts
Δ = (m_t - m_{t-1}) mod K. - Delta Reaction Model: Evaluates modulo step shifts relative to the AI's prior move.
B. Dynamic Learning & Weight Adaptation
- Log-Loss Backpropagation: Evaluates observed moves using negative log-loss
L(p, k) = -ln(max(p[k], 10^-12))to continuously update sub-model weights exponentially. - Fixed-Share Tracking (
α_share = 0.02): Redistributes weight across sub-models continuously, preventing catastrophic forgetting and instantly adapting if the player changes strategy mid-game. - Statistical Significance Gating: Measures Kullback-Leibler (KL) divergence against uniform random noise and applies Z-score null-hypothesis gating (
Z < 2.0) to prevent overfitting on small sample sizes.
C. Difficulty Modes & Strategy Engine (StrategyEngine)
- Difficulty Modes: Easy (Uniform), Medium (Frequency), Hard (Recency + Markov-1/2), Expert (Full 10-Model Ensemble).
- Multi-Threat Avoidance: Sets safety multipliers to 0.0 for all candidate moves where bowler threat is elevated (
P_out ≥ 0.25or within 0.03 of peak), completely neutralizing single-number or multi-number spam traps. - Sub-Linear Utility Flattening: Uses
U(m) = √m / 2.0run scaling to ensure equal, unpredictable sampling across the full 1 to 10 spectrum instead of biasing high numbers like 10. - Isolated Exploration Floor: Restricts 20% random exploration strictly to safe choices (
P_out < 0.20), preventing accidental self-dismissals. - Anti-Cycling Memory Buffer: Applies a geometric penalty (
0.85^depth) over a 6-ball lookback window on the AI's own choices to keep its pattern unreadable. - Test/Debug & Customizable Wickets Mode: Supports 1 to 10 configurable wickets per innings, live
P(1)...P(10)probability grids, normalized entropyH, Brier loss tracking, and persistent JSON profiles.
Challenges we ran into
Development Challenges & Solutions
Category A: Gesture Recognition & Computer Vision Challenges
- Transition Motion Flickering: Rapid hand movement during throwing motions created false intermediate readings.
- Solution: Implemented a dynamic wrist velocity filter (
Δv_wrist < ε) so evaluation occurs only when hand motion stabilizes.
- Solution: Implemented a dynamic wrist velocity filter (
- Dual-Hand Overlap Distortion (6 to 10): Crossing hands in front of the camera obscured landmark points.
- Solution: Added Z-axis relative depth variance and bounding-box spatial separation to disambiguate overlapping palms.
- Low-Light / Motion Blur Jitter: Dim environments blurred frame boundaries.
- Solution: Built an adaptive frame-dropping gate that discards feature sets below 0.60 confidence.
Category B: Predictive ML & Strategy Challenges
- Multi-Number Bowler Spamming: Players rotating between 3–4 numbers (2, 5, 7, 9) bypassed single-peak threat detectors.
- Solution: Implemented multi-threat parallel index checks that force safety multipliers to 0.0 for all spammed numbers simultaneously.
- High-Number Bias Trap: Linear scoring value (10 > 1) caused the AI to favor high numbers in tight loops.
- Solution: Flattened utility scaling to
U(m) = √m / 2.0and integrated a 6-ball anti-cycling lookback window.
- Solution: Flattened utility scaling to
- Cold-Start Overconfidence (N < 15): Sparse early data caused sub-models to assign overconfident
P ≈ 1.0probabilities.- Solution: Applied Dirichlet/Laplace prior smoothing (
α = 1.0,β = 3.0) and gated active model selection untilN ≥ 15.
- Solution: Applied Dirichlet/Laplace prior smoothing (
- Exploration Floor Safety Leaks: Uniform random exploration (20%) occasionally picked spammed bowler numbers.
- Solution: Restructured exploration floor distribution to sample exclusively from safe choices (
P_out < 0.20).
- Solution: Restructured exploration floor distribution to sample exclusively from safe choices (
Tracks Applied (1)
Freshman Track
Discussion
Builders also viewed
See more projects on Devfolio
