First-wins reduction over scored root moves: a strictly better score replaces the leader, a tie keeps the earlier move, so the same scores in the same order always choose the same move - the property that keeps a parallel root split deterministic.
import { firstWins } from '@datamoc/mwg/ai';console.log(firstWins([{ move: 'a', score: 1 }, { move: 'b', score: 1 }], true)); // 'a'console.log(firstWins([{ move: 'a', score: 1 }, { move: 'b', score: 2 }], true)); // 'b' Copy
import { firstWins } from '@datamoc/mwg/ai';console.log(firstWins([{ move: 'a', score: 1 }, { move: 'b', score: 1 }], true)); // 'a'console.log(firstWins([{ move: 'a', score: 1 }, { move: 'b', score: 2 }], true)); // 'b'
First-wins reduction over scored root moves: a strictly better score replaces the leader, a tie keeps the earlier move, so the same scores in the same order always choose the same move - the property that keeps a parallel root split deterministic.