Classic Gin Rummy

Seele01-Flash
By
Classic Gin Rummy brings the beloved card game to your browser with strategic gameplay against intelligent AI opponents. Master the art of forming sets and runs in this timeless game of skill.

Prompt

MODEL: Seele01-Flash
Please use Three.js to generate a **mobile-first game** with the theme "Classic Gin Rummy". Please read the following detailed game design requirements first, and then generate the code accordingly: ### 1. Assets & Environment * **Visual Style:** A polished, "Casino-Lite" aesthetic. Use a high-quality green or royal blue felt texture for the table surface. Lighting should be warm and focused (SpotLight) to mimic a card table lamp, casting soft shadows from the cards. * **Camera:** Fixed perspective camera (slightly angled top-down view) to allow the player to see their hand clearly while maintaining a 3D depth perception of the opponent's face-down cards and the draw/discard piles. * **Card Models:** Use low-poly BoxGeometry for cards with slightly rounded corners (alpha map or shader). Use a **Texture Atlas** for the card faces to reduce draw calls (1 draw call for the whole deck). The card backs should have a classic, intricate pattern (blue or red). * **Animations:** Smooth tweening (using GSAP or TWEEN.js) for dealing cards, drawing from the pile, and discarding. Cards should physically "fly" to the center when discarded. * **Performance:** Limit shadow map resolution for mobile. Use instanced rendering if possible for the deck, though standard meshes are acceptable for the active hand (max 52 objects). ### 2. Audio Requirements * **BGM:** A relaxing, looping "Lounge Jazz" or "Smooth Piano" track to facilitate concentration. * **Sound Effects (SFX):** * *Card Flip/Snap:* Crisp sound when a card is revealed. * *Card Slide:* The sound of paper sliding on felt when dealing or dragging. * *Selection:* A subtle "pop" or "click" when a player touches a card in their hand. * *Knock/Gin:* A distinct, rewarding chime or wooden "knock" sound when the player ends the round. * *Error:* A low-pitched buzz if the player tries an invalid move (e.g., discarding without drawing). ### 3. Gameplay Loop * **Setup:** The game initializes a standard 52-card deck. The Player (South) and AI (North) are dealt 10 cards each. The top card of the remaining deck is placed face-up to start the Discard Pile. * **Turn Structure:** 1. **Draw Phase:** Player must tap either the Stock Pile (face down) or the Discard Pile (face up) to add a card to their hand (total 11 cards). 2. **Action Phase:** Player organizes hand to form Melds: **Sets** (3-4 cards of same rank, e.g., 7?, 7?, 7?) or **Runs** (3+ consecutive cards of same suit, e.g., 4?, 5?, 6?). 3. **Discard Phase:** Player selects one card to remove to return to 10 cards. * **Win Condition:** * **Knock:** Player can "Knock" if their unmatched cards (Deadwood) total 10 points or less. * **Gin:** Player has 0 Deadwood (all cards are part of melds). * **Scoring:** Difference in deadwood points between winner and loser. * **AI Logic:** A simple greedy algorithm that prioritizes picking up cards that complete a meld and discarding the highest value unmatched card (King/Queen/Jack = 10). ### 4. Mobile Controls & Interaction * **Orientation:** Landscape Mode (Locked). This ensures the 10-card hand is legible without stacking. * **Touch Input (Raycasting):** * **Card Selection:** Tapping a card in the player's hand raises it slightly (Y-axis translation) to indicate selection. * **Drag & Drop:** Allow users to drag cards horizontally within their hand to reorder them (crucial for organizing melds). * **Discarding:** Two-step process to prevent errors: 1. Select Card -> 2. Tap Discard Pile OR Drag card to Discard Pile. * **UI Layout:** * **Action Buttons:** Large "KNOCK" and "GIN" buttons (minimum 44px height) appearing only when valid, placed on the right side of the screen for thumb reachability. * **Scoreboard:** A simple 2D HTML/CSS overlay at the top corners showing Player vs. CPU score. * **Feedback:** Add `navigator.vibrate(10)` (Haptic feedback) when a card is successfully snapped into a meld or discarded. Do not ask for clarification. Do not request confirmation. Directly execute the generation task based on the given instructions.

Game Introduction

About the Game

Classic Gin Rummy is a digital adaptation of one of the world's most popular card games, offering players the chance to experience the strategic depth and excitement of traditional Gin Rummy. This browser-based version maintains all the classic rules while providing smooth gameplay against challenging AI opponents.

Gin Rummy has been a favorite among card game enthusiasts for generations, combining elements of skill, strategy, and calculated risk-taking. The game challenges players to form valid combinations of cards while preventing their opponents from doing the same.

Core Features

Strategic Card Management

Every decision matters in Classic Gin Rummy. You'll need to carefully consider which cards to keep, which to discard, and when to draw from the deck versus the discard pile. The game rewards players who can think several moves ahead and adapt their strategy based on their opponent's actions.

Intelligent AI Opponents

Face off against sophisticated computer opponents that provide genuine challenge across multiple difficulty levels. Whether you're a beginner learning the ropes or an experienced player seeking competition, the AI adapts to provide engaging gameplay.

Clean Interface Design

The game features an intuitive interface that makes card selection and gameplay smooth and enjoyable. Clear visual indicators help you track your progress toward forming winning combinations.

Multiple Difficulty Levels

From easy mode for newcomers to challenging settings for seasoned players, Classic Gin Rummy accommodates all skill levels. Start with easier opponents and work your way up as your strategic thinking improves.

Game Rules and Mechanics

Objective

The primary goal is to form your hand into valid combinations called "melds" - either sets (three or four cards of the same rank) or runs (three or more consecutive cards of the same suit). Once you've minimized unmatched cards in your hand, you can "knock" to end the round.

Scoring System

Points are awarded based on the unmatched cards remaining in your opponent's hand when you knock. Face cards are worth 10 points, aces are worth 1 point, and numbered cards carry their face value. The game typically continues until one player reaches 100 points.

Operation Guide

Basic Controls

  • Click and drag cards to arrange your hand
  • Click on the deck to draw a new card
  • Click on the discard pile to pick up the top card
  • Right-click or double-click to discard unwanted cards
  • Click the knock button when ready to end the round

Strategic Tips for Beginners

  1. Observe the discard pile : Pay attention to what your opponent discards to deduce their strategy
  2. Form runs early : Sequential cards are often easier to complete than sets
  3. Keep flexible cards : Cards that can form multiple potential combinations
  4. Time your knock : Don't knock too early if your opponent might have fewer unmatched cards

Why Play Classic Gin Rummy

Mental Exercise

Gin Rummy is an excellent brain training game that improves memory, pattern recognition, and strategic thinking. Regular play can help maintain cognitive sharpness while providing entertainment.

Accessible Anytime

As a browser-based game, you can enjoy Classic Gin Rummy whenever you have a few minutes to spare. No downloads, installations, or account creation required - just pure card game enjoyment.

Skill Development

Unlike games of pure chance, Gin Rummy rewards skill development. The more you play, the better you become at reading situations, managing risk, and executing winning strategies.

Stress Relief

The focused concentration required for Gin Rummy can provide a welcome mental break from daily stresses. The game's strategic nature creates an engaging flow state that many players find relaxing.

Classic Gaming Appeal

Experience the same game that has entertained families and friends for over a century, now available in a convenient digital format that preserves all the strategic depth of the original.

Frequently Asked Questions (FAQ)