Skip to content

Conversation

@luccabb
Copy link
Owner

@luccabb luccabb commented Jan 20, 2026

Summary

  • Sort captures by MVV-LVA (Most Valuable Victim - Least Valuable Attacker)
  • Add killer moves heuristic for quiet move ordering
  • Track quiet moves that cause beta cutoffs (2 per ply)

Details

MVV-LVA Capture Ordering

Captures are now sorted by MVV-LVA score, putting the best captures first:

  • Taking a queen with a pawn is searched before taking a pawn with a queen
  • Increases the rate of beta cutoffs, reducing nodes searched

Killer Moves Heuristic

Quiet moves that caused beta cutoffs are remembered:

  • Each ply depth keeps track of 2 killer moves
  • Killers are searched immediately after captures
  • Helps find refutation moves faster in similar positions

Move Ordering Priority

  1. Captures - sorted by MVV-LVA
  2. Killer moves - quiet moves that caused cutoffs at this ply
  3. Other quiet moves - shuffled for variety

Test plan

  • All 64 unit tests pass
  • Verified killer moves are updated on beta cutoffs

🤖 Generated with Claude Code

@luccabb luccabb force-pushed the feature/quiescence-search-improvements branch from e8b9ff6 to df8a32b Compare January 21, 2026 06:40
@luccabb luccabb force-pushed the feature/mvv-lva-killer-moves branch from 0b53062 to 944a0e0 Compare January 21, 2026 06:40
@luccabb luccabb force-pushed the feature/quiescence-search-improvements branch from df8a32b to bfb11c1 Compare January 21, 2026 06:44
@luccabb luccabb force-pushed the feature/mvv-lva-killer-moves branch from 944a0e0 to f1001bf Compare January 21, 2026 06:44
@luccabb luccabb changed the base branch from feature/quiescence-search-improvements to feature/transposition-table-bounds January 21, 2026 07:00
@luccabb luccabb changed the title [5/9] Add MVV-LVA capture ordering and killer moves heuristic [3/7] Add MVV-LVA capture ordering and killer moves heuristic Jan 21, 2026
@luccabb luccabb force-pushed the feature/transposition-table-bounds branch from 4f7fad5 to 1c7b8d9 Compare January 21, 2026 07:33
luccabb and others added 2 commits January 20, 2026 23:33
Enhances quiescence search with better handling of special positions:

**Draw Detection:**
- Check fifty-move rule and insufficient material
- Detect repetitions when making moves (return 0 for draws)

**Check Handling:**
- When in check, search ALL legal moves (evasions), not just captures
- Can't use stand-pat for pruning when in check (position is unstable)
- Separate best_score tracking for in-check vs normal positions

**Tactical Move Detection:**
- Add `is_tactical_move()` helper function
- Tactical moves: captures, promotions, and checks
- Previously included quiet pawn pushes (is_zeroing), now more precise

**Move Ordering:**
- Update `organize_moves_quiescence()` to use is_tactical_move
- Sort tactical moves by MVV-LVA

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Improves move ordering for better pruning:

**MVV-LVA (Most Valuable Victim - Least Valuable Attacker):**
- Sort captures by MVV-LVA score in `organize_moves()`
- Best captures (e.g., pawn takes queen) searched first
- Increases beta cutoff rate for better pruning

**Killer Moves Heuristic:**
- Track quiet moves that cause beta cutoffs (2 per ply)
- Add `killers` parameter to `organize_moves()` and `negamax()`
- Killer moves searched after captures, before other quiet moves
- Killers stored in a table indexed by ply depth

**Move Ordering Priority:**
1. Captures (sorted by MVV-LVA)
2. Killer moves (quiet moves that caused cutoffs at this ply)
3. Other quiet moves (shuffled for variety)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@luccabb luccabb force-pushed the feature/mvv-lva-killer-moves branch from f1001bf to 98ee9e1 Compare January 21, 2026 07:33
@luccabb luccabb changed the title [3/7] Add MVV-LVA capture ordering and killer moves heuristic [3/6] Add MVV-LVA capture ordering and killer moves heuristic Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants