A real-time multiplayer Go territory counting game where players compete to correctly identify which side controls more territory in various Go positions.
๐ฎ Play Now at counting-battle.ajiweaver.com
Counting Battle! is based on Anton Tobi's Count! but adds multiplayer functionality with rooms, a real-time leaderboard, room history, and a hard mode where you can train exact counting.
- Create a room
- Set game options inside the room, only the host can change these settings.
- Choose difficulty: In normal mode you only have to choose which color wins, while hard mode
- Invite friends by sharing the room link - click the ๐ button to copy the direct join link.
- Play!
Notes:
- If your timer runs out, you lose.
- If you answer correctly all boards before anybody else, you win.
- 1 correct answer is 1 point
- Every time you make a mistake, you will be forced to wait for 1 second.
- If you resign, the game will continue while there's at least 1 more player playing.
- If you open the "Leaderboard" dialog while playing, you can see everyone's scores changing in real time.
- Real-time multiplayer with Socket.IO
- Two game modes: Normal (Black/White winner) and Hard (exact territory counting)
- Customizable game settings (timer, board count)
- Live leaderboards during gameplay with status icons (๐ฎ playing, โ finished)
- Persistent room history and total scores
- Visual feedback (green for correct, red for incorrect, gold for winners)
- Trophy/medal system for winners and ties (๐ single winner, ๐ฅ ties)
- Development mode indicators (๐ง wrench icon for dev mode players)
- Host controls for game management
- Mobile-responsive design
- Frontend: Vanilla JavaScript, p5.js for game rendering
- Territory Scoring: lightvector/goscorer library for accurate scoring
- Backend: Node.js, Express, Socket.IO
- Deployment: Railway (server), Netlify (client)
- Real-time Communication: WebSocket connections via Socket.IO
- Node.js 18+
- npm
-
Clone the repository
git clone https://github.com/ajiweaver/counting cd counting -
Install dependencies
npm run install-server
-
Serve the files
# cd to repository's root python3 -m http.server 8000 -
Start the server
npm start
-
Open the game At
localhost:8000
The game auto-detects the environment:
- Local: Uses
http://localhost:3000for the server,http://localhost:8000for the client - Production: The client is deployed at
https://count.ajiweaver.com
- Each Go position shows equal stones for Black and White
- No komi, no prisoners, no sekis
- Area scoring and territory scoring give identical results
- Normal Mode: Just decide who won, black or white
- Hard Mode: Choose the winning color by clicking on the first stone on the bottom of the screen and then choose by how much.
- Lobby Phase: Players join and wait for game start
- Playing Phase: Real-time competition on the same board sequence
- Finished Phase: Results shown with winner highlighting
- Auto-finish: Game ends when first player completes all boards
- Mouse/Touch: Click Black/White buttons
- Keyboard: Left/Right arrows (Black/White), Escape (resign)
counting/
โโโ index.html # Main game interface
โโโ about.html # Game instructions
โโโ board-editor.html # Visual board editor (localhost only)
โโโ multiplayer.js # Client-side multiplayer logic
โโโ board-editor.js # Board editor functionality
โโโ boards.js # Normal mode Go board positions
โโโ boards_hard.js # Hard mode Go board positions
โโโ deadstones.js # Normal mode dead stone data
โโโ deadstones_hard.js # Hard mode dead stone data
โโโ goscorer.js # Go territory scoring library
โโโ name-generator.js # Random player name generation
โโโ style.css # Game styling
โโโ server/
โ โโโ server.js # Express + Socket.IO server
โ โโโ package.json # Server dependencies
โโโ package.json # Root package configuration
When running on localhost, additional features become available:
- Access: Board Editor button appears on main menu (localhost only)
- Features: Visual stone placement, dead stone marking, territory scoring
- Export: Generate updated boards.js and deadstones.js files
- Keyboard Shortcuts: Navigation, tool selection, undo/redo support
- Toggle: Development Mode checkbox (localhost only)
- Features: Shows correct answers during gameplay
- Visual Indicator: Players in dev mode get wrench icon ๐ง in UI
// Mock data testing
showMockData() // Enable mock data for testing
hideMockData() // Disable mock data
setRealBoardId(1) // Test with board id
// Data querying
queryLeaderboard() // View all leaderboard data
debugLeaderboard() // Debug leaderboard display
debugRoomHistory() // Debug room history display
// Board testing
showMockBoards() // View available test boards
setTestBoardId(0) // Load specific board for testing- Persistent Rooms: Rooms stay active until all players leave
- Host Privileges: Room creators can start games and return to lobby
- Auto-reconnection: Hosts automatically reconnect to their existing rooms
- Room History: Track all completed games with detailed results
- Responsive UI with mobile-first approach
- Real-time feedback with background color changes
- Trophy system with emoji indicators (๐ for single winner, ๐ฅ for ties)
- Status indicators (๐ฎ playing, โ finished, ๐ง dev mode)
- Smooth animations for interactions and state changes
- Tooltips for enhanced user experience
MIT License - see LICENSE.md for details.
- Original concept by Anton Tobi
- Built with love for the Go/Weiqi/Baduk community
Ready to battle? Create a room and challenge your friends to see who's the best at counting territory! ๐ฅ