💡 摘要
一个现代的俄罗斯方块游戏,使用React和TypeScript构建,具有先进的机制和AI模式。
🎯 适合人群
寻找经典体验的休闲玩家对React和TypeScript感兴趣的开发者希望探索游戏策略的AI爱好者寻求响应式游戏体验的移动玩家专注于国际化的本地化专家
🤖 AI 吐槽: “看起来很能打,但别让配置把人劝退。”
安全分析中风险
风险:Medium。建议检查:是否执行 shell/命令行指令。以最小权限运行,并在生产环境启用前审计代码与依赖。
🎮 Tetris Game
A modern Tetris implementation built with React, TypeScript, and Bun.
✨ Features
- Classic Tetris gameplay with all seven tetrominoes
- Advanced mechanics: Super Rotation System (SRS), T-Spin detection, hold piece
- Responsive design for desktop and mobile
- Internationalization: English and Japanese support
- AI mode: Watch the AI play with configurable strategies
🎮 Controls
Desktop
- Arrow Keys: Move left/right/down
- Up Arrow: Rotate clockwise
- Space: Hard drop
- Shift: Hold piece
- P: Pause
- R: Reset
Mobile
Touch controls with on-screen buttons
🚀 Getting Started
# Install dependencies bun install # Start development bun run dev # Run tests bun test
🛠️ Tech Stack
- Runtime: Bun 1.3.5
- Frontend: React 19.2.4 + TypeScript 5.9.3
- State: Zustand 5.0.10
- Styling: Tailwind CSS 4.1.18 + Radix UI
- Build: Rolldown-Vite 7.3.1
- Testing: Bun Test + fast-check
📁 Project Structure
src/
├── App.tsx # Main application component
├── game/ # Core game logic
├── ui/ # UI components
├── assets/ # Static assets and locales (en, ja)
├── hooks/ # Custom React hooks
└── types/ # TypeScript definitions
🧪 Development
bun run dev # Development server bun test # Run tests bun run format # Format code (write) bun run format:check # Check formatting bun run lint # Lint & auto-fix bun run lint:check # Lint (check only) bun run typecheck # Type checking bun run build # Production build bun run check:i18n # Check i18n key consistency
🌍 Internationalization
The game supports two languages:
- English (
en) - Default language - Japanese (
ja) - Full Japanese localization
Translation files are located in src/assets/locales/. Language settings are persisted in localStorage and synchronized with the game state.
A modern take on the classic game, optimized for performance and developer experience.
五维分析
清晰度9/10
创新性7/10
实用性8/10
完整性8/10
可维护性9/10
优缺点分析
优点
- 引人入胜的经典游戏玩法
- 先进的机制增强策略性
- 适应各种设备的响应式设计
- 支持国际化
缺点
- 语言支持有限(仅支持英语和日语)
- 依赖Bun运行时
- 初学者可能有较陡的学习曲线
- AI模式可能不适合所有玩家
相关技能
免责声明:本内容来源于 GitHub 开源项目,仅供展示和评分分析使用。
版权归原作者所有 sakataka.
