v0.4.5 - fix bug with not being able to drop cars

This commit is contained in:
Jesse
2026-08-14 23:22:00 -04:00
parent 6655e20ea8
commit 98f93e6691
5 changed files with 191 additions and 9 deletions
+10 -2
View File
@@ -945,6 +945,8 @@ describe('the bot does not lay track that cannot work (regression)', () => {
assert.ok(lays.length > 3, `the bot laid only ${lays.length} pieces`);
});
const SEEDS = [1000, 8919, 16838, 24757, 32676, 40595, 48514, 56433];
it('rarely lays rail that butts a card which cannot accept it', () => {
// A port facing an EMPTY square is a promise — something may be built there later. A port
// butting an OCCUPIED square whose card has no matching port is not: that square is taken, so
@@ -956,7 +958,13 @@ describe('the bot does not lay track that cannot work (regression)', () => {
// placements measured better and cut these from 28% of pieces to 7%.
let laid = 0;
let dead = 0;
for (const seed of [1000, 8919, 16838, 24757, 32676]) {
/**
* EIGHT GAMES, NOT FIVE. Five stopped yielding a big enough sample once crews could back out of
* a curve: the bot has more switching worth doing, so it spends fewer turns laying track, and
* the count fell to 34 against a floor of 40. Seeds added on the same stride rather than the
* floor lowered — the floor is what makes the RATE below mean anything.
*/
for (const seed of SEEDS) {
const s = createGame({
id: `dp-${seed}`, seed,
config: { ...config, length: 'standard' },
@@ -995,7 +1003,7 @@ describe('the bot does not lay track that cannot work (regression)', () => {
};
playGame(s, spy as never, pump);
}
assert.ok(laid > 40, `only ${laid} pieces laid across five games`);
assert.ok(laid > 40, `only ${laid} pieces laid across ${SEEDS.length} games`);
const rate = dead / laid;
/**
* RAISED FROM 0.15 TO 0.25 WHEN THE OPENING DEAL CHANGED, and that is a regression, not a