Fix suitbuilder early termination and add armor level scoring

Bug fixes:
- Remove "TEMPORARY FIX" that stopped search after finding first suit
- Add armor level as lowest-priority tiebreaker in scoring

Scoring formula now:
- Set completion: +1000 per complete set
- Missing pieces: -200 penalty each
- Crit damage: +10/20 per item
- Damage rating (clothes): +10/20/30
- Spell coverage: +100 per fulfilled spell
- Base item score: +5 per item
- Armor level: +1 per 100 AL (tiebreaker)

Updated design doc with audit findings - most features were already
working correctly. The magsuitalgo.md analysis was outdated.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
erik 2026-01-30 19:04:22 +00:00
parent 45987cfc39
commit 0fd539bedf
2 changed files with 90 additions and 81 deletions

View file

@ -1322,11 +1322,6 @@ class ConstraintSatisfactionSolver:
suit_data['stats']['secondary_set'] = secondary_set_name
yield SearchResult(type="suit", data=suit_data)
# TEMPORARY FIX: Stop search after finding first suit to test completion
if len(self.best_suits) >= 1:
logger.info(f"[DEBUG] EARLY TERMINATION: Found {len(self.best_suits)} suits, stopping search for testing")
return
else:
logger.info(f"[DEBUG] Suit REJECTED: score {suit.score} not better than existing")
else:
@ -1615,7 +1610,13 @@ class ConstraintSatisfactionSolver:
base_item_score = len(state.items) * 5
score += base_item_score
logger.debug(f"[SCORING] Base item score: {len(state.items)} items = +{base_item_score} points")
# 6. Armor level as tiebreaker (LOWEST PRIORITY)
# Scale down significantly so it only matters when other scores are equal
armor_score = state.total_armor // 100 # ~5 points per 500 AL
score += armor_score
logger.debug(f"[SCORING] Armor level tiebreaker: {state.total_armor} AL = +{armor_score} points")
logger.debug(f"[SCORING] Final score: {score}")
return max(0, score) # Never negative