tobymao / 18xx

A platform for playing 18xx games online!
https://18xx.games
Other
280 stars 182 forks source link

[1822] autorouter is giving invalid revenue calculations #11078

Open PistonPercy opened 1 month ago

PistonPercy commented 1 month ago

How to Reproduce the Bug? This isn't really an 1822-specific issue, but the example I found is an 1822 game. https://18xx.games/game/158030?action=1349 If you manually route vs auto route, you get different revenues and I believe the manual routing is correct.

Manual:

Auto:

I think the issue is due to the implementation of TRAIN_AUTOROUTE_GROUPS the E train's revenue is calculated separately from the 2P train, but the destination bonus is calculated based on the all routes, but the auorouter only sets routes for the train group.

The bug also causes some weird behavior if you only clear one train because the routes property isn't set properly on the train that isn't cleared.

I'm guessing the fix is either to reset the routes property + recalculate revenue in auto_router.rb or in route_selector.rb.

Which Browser / Platform?

Safari 17.5

ChrisTheCat commented 1 month ago

Another example of the bug: https://18xx.games/game/168473?action=1255