-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fighting greed #478
Comments
This is the code fragment that I'm talking about:
When I disable the GREEDY check, so the code becomes
then the problem disappears: I can happily lay tile 23 both ways, including (in a somewhat different situation): However, this change does not fix the 1830 routing bug in #221 (1830) and the rotation failure in #435 (18Ches). I'm currently testing with saved files from various games to check if this deletion affects route finding and revenue calculations in any way, but so far all seems OK. If it stays this way, and lacking any info on what GREEDY really means, I may decide to apply this fix to the code base. |
I have further tested in several ways:
Of course this is not a complete proof of the harmlessness of removing the GREEDY check. But I am confident that any glitches will be absent or rare. I remain open to demonstrations to the contrary. I will add this fix to the currently open PR #471. |
The check in NetworkGraph.getReachableSides() on an edge having GREEDY status has been disabled. This resolves issue Rails-18xx#478. Also a bug in ListAndFixSavedFiles that mixed up Stop and Station numbers has been fixed.
The check in NetworkGraph.getReachableSides() on an edge having GREEDY status has been disabled. This resolves issue Rails-18xx#478. Other fixes: - A bug in ListAndFixSavedFiles that mixed up Stop and Station numbers. - Distances from tokenable stops to the nearest base token went wrong when hexes had multiple cities on one hex (e.g. Paris in 1826).
Copying a comment of mine in #435: (see next comment for additional info)
I think I have found another case where a valid rotation is not allowed. It is in 1826 that I'm now working on.
The green tile 23 that I'm trying to lay on the hex NW of Paris is only allowed in this rotation, not in the equally valid 180° rotated one.
Muddling through the rotation code jungle, the root cause seems to be that the SE side of that hex is marked as "GREEDY".*
Does that really mean that no token is present behind that side (i.e. in Paris NW)? Well, that token is there, and the train routing code finds it well enough, see the pink line.
Is there anyone around who can explain this?
Talking about greediness, there are four possible enum values for that field: SEEN, DONE, GREEDY and NOT_GREEDY.
No documentation, of course. Can anyone explain the meaning of these values to me?
This all looks needlessly complicated. I'm thinking of replacing the code to find valid tile rotations by just a simple check: is there a token in any given direction, or not.
I don't know if the Chesapeake problem has the same cause, perhaps it is worth a check.
* See NetworkGraph.getReachableSides().126
The text was updated successfully, but these errors were encountered: