A modern, responsive implementation of the classic Klotski sliding block puzzle game. Play the timeless Chinese puzzle online with multiple configurations, save/load functionality, and beautiful animations.
Play the game online: Klotski
Experience the classic Klotski puzzle with modern web technology. No downloads required - play directly in your browser!
Klotski (ๅๅฎน้, Huฤ Rรณng Dร o) is a classic sliding block puzzle that originated in ancient China. The name translates to "Huarong Pass" and refers to a famous historical event from the Three Kingdoms period. The objective is to move the large red block (typically 2x2) from its starting position to the designated exit area.
- Origin: Ancient Chinese puzzle with hundreds of years of history
- Cultural Heritage: Part of traditional Chinese intellectual games
- Mathematical Interest: Studied extensively by mathematicians and computer scientists
- Educational Value: Improves spatial reasoning and logical thinking
- Multiple Configurations: 4 different starting layouts with varying difficulty
- Save/Load Progress: Local storage for game state persistence
- Move Counter: Track your progress and optimize solutions
- Responsive Design: Play on desktop, tablet, or mobile devices
- Keyboard Controls: Arrow keys and shortcuts for efficient gameplay
- Visual Feedback: Clear indicators for selected blocks and valid moves
- Modern Web Technologies: Pure HTML5, CSS3, and JavaScript
- Touch Support: Optimized for mobile and tablet devices
- Cross-Browser Compatible: Works on all modern browsers
- No Dependencies: Lightweight and fast loading
- SEO Optimized: Rich content and proper meta tags
- Accessibility: Keyboard navigation and screen reader support
- Touch Controls: Drag and drop interface for mobile devices
- Responsive Layout: Adapts to any screen size
- Performance Optimized: Smooth animations on mobile devices
- Offline Capable: Works without internet connection
Visit https://klotski.org to play the game directly in your browser.
-
Clone the repository
git clone https://github.com/yourusername/klotski-game.git cd klotski-game -
Open in browser
# Using Python 3 python -m http.server 8000 # Using Node.js npx serve . # Or simply open index.html in your browser
-
Start playing Navigate to
http://localhost:8000in your browser
Move the large red 2x2 block to the exit at the bottom of the board.
- Mouse/Touch: Drag blocks directly to move them
- Arrow Keys: Use arrow keys to move selected blocks
- Direction Buttons: Click the arrow buttons on screen
- Keyboard Shortcuts:
Ctrl+R: Reset gameCtrl+S: Save gameCtrl+O: Load gameCtrl+1toCtrl+4: Switch configurations
- All blocks can only move horizontally or vertically
- Blocks cannot be lifted or rotated
- The goal is to create a path for the main block to reach the exit
- Some configurations require 100+ moves for optimal solutions
klotski-game/
โโโ index.html # Main game page
โโโ game.js # Game logic and mechanics
โโโ contact.html # Contact page
โโโ about.html # About us page
โโโ privacy.html # Privacy policy
โโโ terms.html # Terms of service
โโโ README.md # This file
โโโ README_HTML.md # HTML documentation
The game includes 4 classic Klotski configurations:
- Configuration 1: Classic "ๆจชๅ็ซ้ฉฌ" (Heng Dao Li Ma) - Moderate difficulty
- Configuration 2: "ๅฐๆฅๆน่ฅ" (General Guarding Cao's Camp) - Advanced
- Configuration 3: "ๅ ตๅไธ่ทฏ" (Troops Divided in Three Ways) - Expert
- Configuration 4: "ๅฑๅฑ่ฎพ้ฒ" (Multiple Layers of Defense) - Master level
Each configuration offers unique challenges and requires different solving strategies.
You can easily add new puzzle configurations by modifying the configurations array in game.js:
const configurations = [
// Add your custom configuration here
{
name: "Custom Puzzle",
board: [
// Define your board layout
]
}
];The game uses CSS custom properties for easy theming. Modify the CSS variables in index.html to change colors and styling.
- Load Time: < 1 second on modern connections
- Memory Usage: Minimal, optimized for mobile devices
- Compatibility: Works on browsers from 2018 onwards
- Accessibility: WCAG 2.1 AA compliant
| Browser | Version | Status |
|---|---|---|
| Chrome | 70+ | โ Full Support |
| Firefox | 65+ | โ Full Support |
| Safari | 12+ | โ Full Support |
| Edge | 79+ | โ Full Support |
| Mobile Safari | 12+ | โ Full Support |
| Chrome Mobile | 70+ | โ Full Support |
We welcome contributions! Here's how you can help:
- ๐ Report Bugs: Use the issue tracker
- ๐ก Suggest Features: Share your ideas for new features
- ๐ง Code Contributions: Submit pull requests for improvements
- ๐ Documentation: Help improve documentation and tutorials
- ๐ Translations: Add support for additional languages
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow existing code style and conventions
- Add comments for complex logic
- Test on multiple browsers and devices
- Ensure mobile responsiveness
This project is licensed under the MIT License - see the LICENSE file for details.
- Historical Research: Based on traditional Chinese Klotski puzzles
- Mathematical Analysis: Inspired by academic research on sliding block puzzles
- Community: Thanks to all contributors and puzzle enthusiasts
- Open Source: Built with open web standards and technologies
- Website: https://klotski.org
- Email: contact@klotski.org
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with โค๏ธ for puzzle enthusiasts worldwide
Experience the timeless challenge of Klotski - where strategy meets tradition in a modern web interface.
Play Now: Klotski | Learn More: About Klotski | Contact: Get in Touch
More Games: 15 PuzzleใMahjong Link