How ed-donner/connect works
Four-in-a-row Arena is a Gradio app for running Connect Four matches between LLMs. Users choose two models, start a game, and advance one move at a time or run the match; the app displays the board and players’ reasoning. Completed-game records support recent-game history and an ELO leaderboard. The main flow is visible in the excerpts; MongoDB and OpenRouter integrations are also explicit. Some UI callback details and record-persistence wiring are unsampled, so those links are included only where the shown source establishes them.
Main entry points: c4.py Gradio arena · game.py Game coordinator · board.py Game board · player.py LLM player
Components 11
Arena interface
- App entry
app.py - Gradio arena
arena/c4.py
Match domain
- Game coordinator
arena/game.py - Game board
arena/board.py - Board renderer
arena/board_view.py
Model integration
- LLM player
arena/player.py - LLM adapter
arena/llm.py
History and ratings
- Game records
arena/record.py
Other components
- Arena user
- OpenRouter
- MongoDB
Connections 13
- Arena user → Gradio arena: uses
README.md - App entry → Gradio arena: creates display
app.py - Gradio arena → Game coordinator: starts and advances
arena/c4.py - Gradio arena → Game coordinator: reads history and ratings
arena/c4.py - Gradio arena → Game board: renders board state
arena/c4.py - Game coordinator → Game board: creates and checks
arena/game.py - Game coordinator → LLM player: delegates moves
arena/game.py - Game board → Board renderer: converts to SVG
arena/board.py - LLM player → Game board: reads legal moves; applies move
arena/player.py - LLM player → LLM adapter: requests structured move
arena/player.py - LLM adapter → OpenRouter: sends model request
arena/llm.py - Game coordinator → Game records: records results; fetches stats
arena/game.py - Game records → MongoDB: reads and writes
arena/record.py