• Mahmoud Aglan's avatar
    fix(ludo): PHASE 2 — correct board layout, fix ALL critical bugs · 5fd78414
    Mahmoud Aglan authored
    Board Layout (matches reference image):
    - Color order: Red(TL), Blue(TR), Yellow(BR), Green(BL)
    - Fixed SHARED_PATH: 52 squares going clockwise correctly
    - Fixed START_SQUARES: [0, 13, 26, 39] — NOW MATCHES rules.js
    - Fixed HOME_COLUMNS: correct paths toward center per player
    - Fixed SAFE_SQUARES: match official Ludo star positions
    - Fixed HOME_ENTRY: correct squares before entering home column
    
    Rules Engine fixes:
    - START_POSITIONS now matches board-map START_SQUARES (was off by 1!)
    - Capture logic: only checks pieces on shared path (pos < 52)
    - Home column pieces CANNOT be captured (pos >= BOARD_SIZE check)
    - Three consecutive 6s = piece goes back home, lose turn
    - Exact finish requirement enforced (must land exactly on 58)
    - Extra turn on: rolling 6, capturing, finishing
    - Bot AI priority fixed: finish > capture > enter > advance furthest
    
    Dead code removed:
    - doMove() cleaned up (was return + unreachable code)
    
    Color order fixed in game scene:
    - COLORS array matches rules.js order
    - COLORS_LIGHT matches too
    Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
    5fd78414
board-map.js 3.85 KB