tobymao / 18xx

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

1822Africa - E train earnings incorrect #9550

Closed scottredracecar closed 1 year ago

scottredracecar commented 1 year ago

https://18xx.games/game/133836?action=369

In this game, the 5/E ran as an E ["Express]", but appears it was counted like an 1830 diesel with 290 earnings.

E-trains should only generate earnings from tokened cities and nothing else, not even the game reserve. The best E run for this turn is two stops, Cape Town (home) to Nairobi (destination), calcluated as 2 (20 + 30 2) = 160

Bonuses are applied after the fact, like the private company bonuses for gold mine or coffee plantation, and thus would add the bonus after the run is totaled (and doubled).

scottredracecar commented 1 year ago

I think this calculates correctly now (thanks!).

There is still some kind of bug, but I'm not sure if it is worth trying to fix now as there is a workaround. It is possible to get into situations where the system won't let me reproduce an optimal route.

To reproduce, go to this action. https://18xx.games/game/133986?action=478

Make a clockwise route from Algiers to Lagos (correctly calculates earnings as an E, great). Then try to pick the optimal route for the other train, which I think is the red route plus Tunis and Cairo, but it won't let me add those on to this route.

image

Workaround is to route the non-E train first.

I see autorouting isn't working properly, possibly this bug is affecting that. Autorouting doesn't seem to want to allow trains to share track at all, perhaps because it prunes routes with conflicting segments. I don't think that is important to solve, but if it comes for free with fixing this other thing, that would be nice.

Possibly this is a case where we would need to revert to the other idea where the user picks whether the train is an E or not. 😕 At least in that case, autorouting should be solved too.

scottredracecar commented 1 year ago

Another issue is this calculation is wrong in that it is applying the destination bonus to the wrong train (should apply it to the E to maximize revenue). Sorry to have saddled you with this tricky problem! I'll note that it is correct that only one train can get the destination bonus from 1822 rules.

image
vandamm commented 1 year ago

@scottredracecar do you think it's critical to try fixing this issue now? Frankly I'm a bit tired of debugging so I'd like to implement all private powers and move the game to beta first, and figure out routing bugs after.

scottredracecar commented 1 year ago

Yeah, I think come back to this later. Some others have dealt with things like this so maybe they can provide advice if/when you are ready to come back to it.

vandamm commented 1 year ago

Per discussion this will be solved by only allowing one */E train per corp to run as Express.