feat: align hex/square visual styles, rename hex pieces#63
feat: align hex/square visual styles, rename hex pieces#63
Conversation
…square Align hex cell rendering with square to ensure consistent visual style: - Match stamp proportions (highlights, shadows, borders) using hex drawn height as reference dimension instead of circumradius - Remove hex Normal border stroke (square has none) - Delete mini stamp functions — reuse full-size stamps at smaller scale - Use apothem-based cell gap for uniform perpendicular spacing - Board border uses polygon offset for even gap on all sides - Ghost pieces use same ghostColor() alphas (remove hardcoded 0.4) - Grid/ghost strokes use height-based formula matching square - Garbage meter: unified 1-column ghost-style for both modes Rename hex pieces to match square counterparts (same name, same color): I4→I, T→J, L→L, S→O, F→S, Tp→T, Fm→Z Rotate J and Z default orientations 60° CCW. Performance: cache sCell/stampHeight/gridLineWidth in constructors, eliminate per-frame allocations (scratch objects, empty arrays, layout cache), batch garbage meter/effects into compound paths, use integer ghost set keys. Add style-comparison visual test (composite square vs hex screenshot) and hex all-pieces+ghosts tests (3 tiers × 8 players). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @tim4724's task in 4m 17s —— View job Code Review
This is a well-engineered PR. The style-alignment work is thorough, performance improvements are thoughtful, and the test coverage is solid. I found a few minor items below but no actual bugs. Architecture / DesignHex stamp API change ( Outline outset algorithm ( if (Math.abs(dot) < 0.001) dot = 1;This silently falls back to 1× outset for near-antiparallel edges (180° convex corners). That's a safe clamp, but worth a comment like
// In constructor, after the assignment:
if (HEX_COLS_N >= _GHOST_KEY_STRIDE || HEX_VIS_ROWS >= _GHOST_KEY_STRIDE) {
throw new Error('_GHOST_KEY_STRIDE too small for board dimensions');
}Or update the constant from PerformanceAll the batching changes are correct and well-structured:
The Tests
await waitForGameRender(page);
// Wait until the render loop has actually drawn hex content to the canvas.
await page.waitForTimeout(200);
Minor nits
SummaryNo blocking issues. The outset guard and |
…e keys Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hex extra ghosts now include x:0, ghostY:0 so the render loop uses the same offset logic for both square and hex — no duck-typing needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hex extra ghosts now include x:0, ghostY:0 so the render loop uses the same offset logic for both modes — no duck-typing needed. Freeze _EMPTY_EFFECTS and _NO_SHAKE to catch accidental mutation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace per-row beginPath/fill with a single compound path per effect, matching the hex garbage effect batching pattern. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move bounds validation into drawGhostBlock itself rather than relying on callers. Both square and hex renderers now guard row and column. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Test plan
🤖 Generated with Claude Code