A modern implementation of the classic Go board game in three dimensions, built with React, TypeScript, and Three.js.
- 3D Game Board: Play Go in a three-dimensional space with customizable board dimensions
- Interactive UI: Intuitive controls for placing stones and navigating the 3D board
- Move History: Navigate back and forth through game moves with full state restoration
- Optional move redo functionality (can be disabled to prevent branching)
- Game Rules Implementation:
- Liberty tracking in 3D space
- Capture mechanics
- Ko rule prevention using Zobrist hashing
- Territory calculation with 3D seki (neutral territory) support
- Stone group detection and analysis
- Manual Scoring Phase:
- Click stones to mark them as dead or alive during scoring
- Click empty territories to assign ownership (neutral → white → black)
- Visual indicators for territory assignments (white, black, neutral)
- Support for 3D seki (territories where both players have influence)
- Game Controls:
- Place stones with mouse clicks during play
- Pass turn (click 'Pass' button or press 'P' key)
- Mark dead stones and territories during scoring phase
- Start new game
- Customize board dimensions
- Navigate move history (back/forward through game moves)
- Game State Management:
- Current player tracking
- Captured stones counter
- Move validation
- Two-pass game ending detection
- Board state persistence through multiple phases
- Frontend Framework: React with TypeScript
- Build Tool: Vite
- State Management: Zustand
- UI Components: React Bootstrap
- Routing: React Router
- 3D Rendering: Three.js
- Code Quality: ESLint
-
Prerequisites
- Node.js (v14 or higher)
- npm or yarn
-
Installation
# Clone the repository git clone [your-repo-url] cd 3d-go # Install dependencies npm install
-
Running the Development Server
npm run dev
-
Building for Production
npm run build
The game follows traditional Go rules adapted for 3D space:
- Players take turns placing stones on intersection points
- Stones are captured when they have no liberties (empty adjacent points)
- Ko rule prevents immediate recapture of stones
- The game ends when both players pass consecutively
- Scoring Phase: After two passes, players enter the scoring phase where they can:
- Click stones to mark groups as dead or alive
- Click empty territories to assign ownership (white, black, or neutral/seki)
- Neutral territories (seki) count as points for neither player
- Final score is calculated based on territory control and captured stones (Chinese scoring rules)
The game board dimensions can be customized through the settings page:
- Width: 3-19 points
- Length: 3-19 points
- Height: 3-19 points
- Place Stone: Click on an intersection point (during play phase)
- Mark Dead Stones: Click on stone groups during scoring phase to toggle dead/alive status
- Assign Territory: Click on empty spaces during scoring phase to cycle through:
- Neutral/Seki (gray indicator)
- White territory (white indicator)
- Black territory (black indicator)
- Pass Turn: Click the "Pass" button or press 'P' key
- New Game: Click "New Game" button
- Settings: Click "Settings" button to adjust board dimensions
- Move History Navigation:
- ⏮️ Start: Jump to the beginning of the game
- ⬅️ Back: Go to previous move
- ➡️ Forward: Go to next move
- ⏭️ End: Jump to the latest move
- Click on any move in the history list to jump directly to that position
- Move Redo Setting: Toggle "Enable move redo when reviewing history" to allow/disallow playing new moves from historical positions (disabled by default)
The game uses Chinese Scoring rules adapted for 3D:
- Territory Points: Count empty enclosed spaces
- Stone Points: Count captured opponent stones
- Dead Stone Handling: Dead stones are removed before territory calculation
- Seki (Neutral Territory): Territories where both players have influence count for neither player
- Final Score: Total territory points + captured stones
The application is built with a modular architecture:
src/components/board/: 3D board rendering components (Grid, Stone, IntersectionPoint)src/game/rules/: Game logic and rule implementation (GameRules, BoardState, LibertyTracker)src/game/scoring/: Scoring system components (ChineseScoring, GroupDetector, DeadGroupDetector, TerritoryFinder)src/game/state/: State management using Zustand (gameStore, useGameActions)src/game/ai/: AI components (for future development)src/pages/: Main game and settings pagessrc/components/ui/: User interface components
- GameRules: Validates moves and manages game flow
- BoardState: Tracks stone positions in 3D
- GroupDetector: Finds connected groups of stones
- DeadGroupDetector: Analyzes groups to detect potentially dead stones
- TerritoryFinder: Identifies empty territories on the board
- ChineseScoring: Calculates final score with seki support
- LibertyTracker: Tracks liberties for groups
- ZobristHash: Implements Ko rule prevention
- Move History System: Tracks complete game state for each move, enabling navigation
- Scoring Determine whether the current implementation, when setting a single territory within a group of territory points, updates all territories in the group to match that point, or if it should only update the selected territory point.
- Add other kinds of scoring, japanese, korean
- Add two-eyes detection for automatic life and death
- Add automatic scoring
- UI Improve UI
- Improve header UI
- Improve coloring
- Settings Add setting default configurations for 19x19x1, 13x13x1, 9x9x1, other common configurations. Also add options for other scoring methods.
- Add board if 2-dimensional
- AI Add AI bot in the future potentially
- Begin with random bots, attaching bots, etc
- Multiplayer Add playing with another player across devices
Contributions are welcome! Please feel free to submit a Pull Request.
None yet
- Created by: Matthew Floresca Tom
- Website: http://matthewflorescatom.com/
- GitHub: https://github.com/MatthewFTom
- Thanks to the Go community for inspiration
- Built with React and modern web technologies