How lolligerhans/cocaco works
Main Components
a. Browser Extension Components:
• Background Script Layer (represented by background-page.html and background.js)
• Content Scripts Layer (main extension logic)
• WebSocket Communication Layer (socket_main.js, socket_isolated.js)
b. Core Functional Modules:
• Game State Tracking System (state.js, player.js)
• Card Tracking System (cocaco.js, trade.js)
• Analysis Engines:
• Dice Roll Analysis
• Resource Tracking
• Rob Tracking
• Data Visualization Layer (plot.js, render.js)
c. External Dependencies:
• Plotly (for visualization)
• statistics.js (for statistical calculations)
• msgpack.js (for data serialization)
Relationship Flows to Highlight
• Data flow from Colonist.io game → WebSocket Layer → State Management
• State Updates → Analysis Engines → Visualization Layer
• User Interactions → State Management → Data Updates
Specific Implementation Details
• Blue rectangles: Core extension components
• Green diamonds: Analysis modules
• Yellow hexagons: External dependencies
• Purple circles: Data storage/state management
• Red rectangles: Communication layers
Architecture Patterns to Emphasize
• Observer Pattern (evident from observer.js)
• Pipeline Architecture (referenced in doc/pipelines.md)
• Event-driven Architecture (for game state tracking)
• Modular Component Structure (shown in the javascript/ directory)
Key Interactions
• Bidirectional communication between the extension and Colonist.io
• Data flow through the analysis pipeline
• State updates and their propagation
• User interaction flows