How minki-art/number-duel works
Number Duel is a server-authoritative, turn-based browser game supporting single-player against four AI levels and LAN/online multiplayer. Players use the browser to create or join a room, take turns choosing an operation, and receive updated game state; the server validates actions, applies rules, and broadcasts results. The documented skills, anti-stalemate rules, room invitations, and AI search are represented. The browser implementation was not sampled, so its internal behavior is shown only at the documented client/server boundary.
Main entry points: server.py WebSocket play · index.html Game UI · game_engine.py Game engine · ai.py AI difficulty selection
Components 11
Browser client
- Game UI
web/index.html
Game service
- Room APIs
server.py - Room coordination
server.py - WebSocket play
server.py - State broadcast
server.py
Game rules
- Game engine
game_engine.py - Action resolution
game_engine.py - Skills and endings
game_engine.py
AI strategy
- AI difficulty selection
ai.py - AI move search
ai.py
Other components
- Player
Connections 13
- Player → Game UI: plays through
README.md - Game UI → Room APIs: creates or joins
README.md - Game UI → WebSocket play: sends moves
README.md - Room APIs → Room coordination: creates rooms
server.py - Room coordination → WebSocket play: coordinates seats
server.py - WebSocket play → Game engine: executes actions
server.py - WebSocket play → AI difficulty selection: requests AI moves
server.py - AI difficulty selection → AI move search: selects strategy
ai.py - AI move search → Game engine: simulates actions
ai.py - Game engine → Action resolution: resolves turns
game_engine.py - Action resolution → Skills and endings: checks skills
game_engine.py - WebSocket play → State broadcast: broadcasts updates
server.py - State broadcast → Game UI: sends game state
server.py