How silentbenjininja/connect-four works
Battle Connect is a browser-based, two-player Connect Four game rendered with Pixi.js. Players choose a column and submit a move; the game updates board state, checks for a win or tie, and presents the outcome. The sampled code shows setup, rendering, input handling, and win-checking behavior, but excerpts omit some connections between these parts. The game’s main implementation is concentrated in script.js; pixi.js supplies the rendering library.
Main entry points: script.js Board state · pixi.js Pixi.js
Components 14
Player controls
- Move input
script.js - Input validation
script.js - Turn control
script.js
Game state and rules
- Board state
script.js - Win check
script.js - Tie check
script.js - Game result
script.js
Rendering and feedback
- Game setup
script.js - Canvas setup
script.js - Board rendering
script.js - Chip animation
script.js - Result feedback
script.js - Pixi.js
pixi.js
Other components
- Two players
Connections 14
- Two players → Move input: choose move
README.md - Move input → Input validation: submits selection
script.js - Input validation → Board state: places chip
script.js - Board state → Win check: checks winning move
script.js - Board state → Tie check: checks remaining spaces
script.js - Win check → Game result: sets win
script.js - Tie check → Game result: sets tie
script.js - Input validation → Turn control: advances turn
script.js - Game setup → Canvas setup: sets up canvas
script.js - Game setup → Board rendering: starts scene
script.js - Canvas setup → Pixi.js: creates renderer
script.js - Board rendering → Pixi.js: creates sprites
script.js - Board state → Chip animation: animates placed chip
script.js - Game result → Result feedback: shows outcome
script.js