How I created a Mahjong Solitaire Game
How I vibe coded a game

Finding the Perfect Game Niche
Every successful web project starts with research. I began my journey by consulting ChatGPT to identify games with low competition on Google—games that people still search for but aren't oversaturated with options. After analyzing various possibilities, mahjong solitaire emerged as the perfect candidate. It's a beloved classic with a dedicated player base, yet there was room in the market for a fresh, well-designed implementation.
The Planning Phase: Breaking Down the Challenge
Rather than diving straight into code, I took a methodical approach. I spent considerable time with ChatGPT, asking detailed questions about every aspect of mahjong solitaire development:
- How should the tile matching logic work?
- What's the best way to structure a 3D tile layout?
- How do I determine which tiles are "free" to select?
- What algorithm should shuffle tiles while ensuring the game is solvable?
- How should I handle the undo feature and hint system?
This Q&A process was invaluable. ChatGPT helped me understand not just the what, but the why behind each game mechanic. By the end of this phase, I had a comprehensive roadmap—a step-by-step blueprint for building the entire game.
Gathering Assets: The Visual and Audio Elements
A mahjong solitaire game is nothing without its distinctive tiles. I scoured the internet for high-quality tile images that captured the traditional aesthetic—bamboos, characters, winds, dragons, flowers, and seasons. Finding the right set took time; they needed to be clear, visually appealing, and properly sized for web display.
Next came the background. I wanted something that evoked the serene, contemplative atmosphere of traditional mahjong without being distracting. After exploring various options, I settled on a subtle, elegant design that complemented the tiles perfectly.
Sound design was equally important. I hunted for satisfying click sounds for tile selection, a pleasant chime for successful matches, and perhaps a gentle shuffle sound for the deal. These audio cues would transform the game from a mere puzzle into an immersive experience.
Prompt Engineering: Crafting the Perfect Request
With all my assets ready and my understanding solidified, it was time for the crucial step: engineering the perfect prompt for ChatGPT. This wasn't a simple "make me a mahjong game" request. Instead, I crafted a detailed, comprehensive prompt that included:
- The exact game rules and mechanics I wanted
- Technical specifications (JavaScript, HTML5 Canvas, responsive design)
- Details about the tile layout structure (the classic turtle/pyramid formation)
- Matching rules (tiles must be free on the left or right side)
- UI requirements (restart button, timer, move counter, hint system)
- How to integrate my specific assets (tile images, background, sounds)
- Performance considerations and browser compatibility
The prompt was essentially a technical specification document, but written in natural language. This level of detail was key to getting usable code on the first attempt.
From ChatGPT to Cursor: Bringing It All Together
I fed my engineered prompt into ChatGPT, which generated a solid foundation of code. But this was just the beginning. I copied the generated code into Cursor, my IDE of choice, where the real magic happened.
Cursor's AI-powered coding assistance allowed me to refine and enhance the game iteratively. I could highlight sections of code and ask for specific improvements:
- "Make the tile selection animation smoother"
- "Add a shuffle animation when dealing tiles"
- "Improve the hint system to highlight better moves"
- "Optimize the matching algorithm for better performance"
This vibe-coding approach—flowing between ChatGPT's broad strokes and Cursor's precise refinements—felt remarkably natural. I wasn't wrestling with syntax or debugging obscure errors. Instead, I was designing and directing, making creative decisions about gameplay and user experience.
The Iteration Process
Even with AI assistance, development was iterative. I playtested constantly, identifying issues:
- Tiles sometimes overlapped incorrectly
- The shuffle algorithm occasionally created unsolvable layouts
- Mobile responsiveness needed tweaking
- Sound effects didn't trigger reliably on iOS
Each problem became a conversation with ChatGPT or a targeted request in Cursor. "Fix the z-index calculation for overlapping tiles." "Ensure the shuffle algorithm always creates a solvable game." "Add touch event handlers for mobile." The AI tools understood context and provided solutions that integrated seamlessly with existing code.
The Final Product
After several days of this collaborative process with AI, I had a fully functional mahjong solitaire game. It featured:
- Smooth, responsive gameplay across devices
- Beautiful traditional tile designs
- An intuitive interface with helpful features
- Engaging sound effects
- A hint system for stuck players
- Score tracking and timing
If you want to see the result of this AI-assisted development journey, you can play mahjong solitaire for free and experience firsthand what's possible when human creativity meets artificial intelligence.
Lessons Learned
This project taught me that modern AI tools have fundamentally changed what's possible for solo developers. I'm not a game development expert, yet I created a polished, playable game in days rather than weeks or months. The key lessons:
- Research matters: Finding the right project through AI-assisted market analysis gave me direction.
- Understanding trumps coding: Spending time learning the mechanics through conversation created better results than jumping straight to code.
- Asset quality counts: No amount of great code compensates for poor visuals and sound.
- Prompt engineering is crucial: Detailed, specific prompts yield better code.
- Iteration is still necessary: AI generates starting points; refinement makes them great.
- The right tools multiply productivity: ChatGPT for planning and generation, Cursor for refinement—each excelled in its role.
The Future of Solo Development
Creating this mahjong solitaire game proved to me that we're in a new era of web development. The barriers to entry have lowered dramatically. You don't need years of game development experience or a team of developers. With curiosity, persistence, and the right AI tools, anyone can transform an idea into reality.
The future belongs to those who can effectively collaborate with AI—who understand that these tools aren't replacements for human creativity but amplifiers of it. My mahjong solitaire game exists because I had the vision, gathered the assets, asked the right questions, and guided the AI toward my goal.
What will you create?




Comments
There are no comments for this story
Be the first to respond and start the conversation.