Skip to content

Move ordering bug? #42

Description

@TampliteSK

ches/src/eval/search.ts

Lines 55 to 74 in 93819c2

function moveOrder(board: Board, move: Move, goodMove?: Move): number {
if (goodMove && moveIsEqual(move, goodMove)) return 1_000_000
switch (move.kind) {
case 'normal': {
// NB: We could just do "material difference" but this would give equal trades score 0, and we don't want that — we still want to look at captures before quiet moves.
const from = board.at(move.from)
const to = board.at(move.to)
if (to === PieceEmpty) return 0
return MVV_LVA[pieceType(to)][pieceType(from)]
}
case 'castling': {
// ...Maybe castling is also usually good? I don't know.
return 500_000
}
case 'enPassant': {
// We always want to prioritize en passant in move search, because en passant is cool. This will only influence bestMove if there is a choice between en passant and a normal capture. (...And maybe not even then.)
return 500_000
}
}
}

In this function you seem to be ordering general captures last, behind hash move (normal), castling (normaln't) and en passant (normaln't), which doesn't seem to be intended
Maximum value for your MVV-LVA is about 10000, when castling and en passant given 500,000. The recommended ordering should be hash move (1m) -> captures (500k? + MVV-LVA. make this include en passant) -> other moves like castling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions