How 0shrihari0/checkers works
Checkers in C combines local terminal play, a TCP multiplayer service and client, and a browser game with local, AI, and WebSocket modes. The principal flow is player input through a game loop, rule and move handling, and board updates; online play routes clients through a protocol to lobby and room handling. Server rooms also support reconnection, spectators, AI games, and history, while SQLite-backed stats and matchmaking are documented capabilities. Some web and server internals are unsampled, so their links rely on README statements or are omitted.
Main entry points: room.c Game rooms · main.c Local game loop · ui.js Browser interface · server.c Lobby and matchmaking
Components 20
Terminal Game
- Local game loop
src/main.c - Terminal UI
src/ui/terminal.c
Game Logic
- Board state
src/game/board.c - Move handling
src/game/moves.c - Rules engine
src/game/rules.c
TCP Multiplayer
- Terminal client
client/client.c - Packet protocol
shared/protocol.c
Server Services
- Lobby and matchmaking
server/server.c - Game rooms
server/room.c - Server AI
server/ai.c - Player database
server/db.c - Game history
server/history.c
Browser Game
- Browser interface
web/ui.js - Web game engine
web/game.js - Browser AI
web/ai.js - WebSocket client
web/multiplayer.js - WebSocket server
web/server.js
Other components
- Terminal player
- TCP player
- Browser player
Connections 23
- Terminal player → Local game loop: plays through
README.md - Local game loop → Terminal UI: requests input and display
src/main.c - Local game loop → Board state: manages state
src/main.c - Local game loop → Move handling: executes moves
src/main.c - Local game loop → Rules engine: checks rules
src/main.c - Move handling → Board state: reads and updates
src/game/moves.c - Rules engine → Board state: uses player state
- TCP player → Terminal client: plays through
README.md - Terminal client → Packet protocol: packs and unpacks
client/client.c - Lobby and matchmaking → Packet protocol: handles packets
server/server.c - Lobby and matchmaking → Game rooms: creates and reconnects
server/server.c - Lobby and matchmaking → Player database: queries profiles and rankings
server/server.c - Game rooms → Packet protocol: sends game packets
server/room.c - Game rooms → Move handling: executes moves
server/room.c - Game rooms → Rules engine: checks game state
server/room.c - Browser player → Browser interface: plays through
README.md - Browser interface → Web game engine: supports local play
README.md - Browser interface → Browser AI: offers AI mode
README.md - Browser interface → WebSocket client: offers online mode
README.md - WebSocket client → WebSocket server: connects by WebSocket
README.md - Game rooms → Server AI: supports AI games
- Game rooms → Game history: logs game history
- Player database → Game history: persists game records