A modern web-based variation of the classic Hexxagon game, built with React, TypeScript, and Phaser. This project features a hexagonal grid game board, AI opponent, and beautiful animations.
Generated using Cursor and claude-3.5-sonnet with minimal human intervention.
Hexorius is a strategic board game played on a hexagonal grid. Players take turns moving and duplicating their pieces while trying to capture opponent pieces. The game combines elements of territory control and strategic movement.
- Two players (human vs computer)
- Players start with 2-5 pieces each (depending on the level)
- On your turn, you can:
- Duplicate: Move to an adjacent hex (creates a copy of your piece)
- Jump: Move to a hex within the level's jump distance (piece moves to new location)
- Moving next to opponent pieces converts them to your color
- Game ends when no valid moves are available
- Player with the most pieces wins
- 🎨 Beautiful, responsive UI with neon-themed visuals and smooth animations
- 🤖 Three AI difficulty levels with distinct strategies:
- Easy: Focuses on basic captures and random moves
- Medium: Considers territory control and piece mobility
- Hard: Uses minimax algorithm with alpha-beta pruning
- 💾 Progress tracking for each difficulty level
- 🎯 15 levels across 5 grid sizes (3x3 to 7x7):
- 📱 Mobile-friendly design with responsive layout
- ⚡ Fast, client-side only implementation
- 🔄 AI battle simulation mode for testing strategies
- Frontend Framework: React 18 with TypeScript
- Game Engine: Phaser 3
- Styling: Styled Components
- Build Tool: Vite
- State Management: Custom game state with React hooks
- Testing: Vitest
src/
├── components/ # React components
│ ├── GameBoard.tsx # Main game board component
│ ├── GameResult.tsx # Game over screen
│ ├── HomeScreen.tsx # Level selection screen
│ └── GameStatus.tsx # Game status panel
├── game/ # Game logic and state management
│ ├── ai/ # AI strategies (Easy, Medium, Hard)
│ ├── scenes/ # Phaser game scenes
│ ├── gameState.ts # Core game state management
│ ├── hexUtils.ts # Hexagonal grid utilities
│ ├── levels.ts # Level configurations
│ ├── progress.ts # Game progress tracking
│ └── types.ts # TypeScript type definitions
├── App.tsx # Main application component
└── main.tsx # Application entry point
- Node.js (v16 or higher)
- npm or yarn
- Clone the repository:
git clone https://github.com/AndreyAkinshin/hexorius.git
cd hexorius- Install dependencies:
npm install- Start the development server:
npm run dev- Open http://localhost:5173 in your browser
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run test- Run testsnpm run lint- Run linternpm run ai-battle- Run AI vs AI simulation
- Click on your piece to select it
- Valid moves will be highlighted:
- Green circles: Duplicate moves (adjacent hexes)
- Magenta circles: Jump moves (within jump distance)
- Click on a highlighted hex to make your move
- Use the top panel buttons to:
- Change AI difficulty
- Restart the current level
- Return to level selection
- Core game logic is handled by
gameState.ts - State updates flow through the Phaser scene to React components
- Progress is persisted in localStorage with separate tracking for each difficulty level
- Three difficulty levels with distinct strategies:
- Easy: Basic evaluation focusing on immediate captures
- Medium: Intermediate strategy considering territory control and mobility
- Hard: Advanced minimax algorithm with alpha-beta pruning and deep evaluation
- AI decisions are based on:
- Piece count and captures
- Board position and territory control
- Available moves and mobility
- Piece clustering and formation
- Phaser handles the game board rendering with:
- Smooth animations for moves and captures
- Neon glow effects and visual feedback
- Responsive hex grid scaling
- React manages the UI components and game flow
- Styled Components provide consistent neon-themed styling
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Original Hexxagon game concept
- Phaser game framework
- React and TypeScript communities