-
Notifications
You must be signed in to change notification settings - Fork 87
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
Prevent falling back to a random card except in very rare circumstances #122
Conversation
As pointed out in #121, it was previously possible for duplicate years or even duplicate cards to be drawn because we'd fall back to the random card choice too often. This was because the tooClose function could return true too easily for certain circumstances. This makes it so tooClose is slightly less strict, but also only applies that function as a second pass, meaning we should fall back to a set of relevant cards instead of the whole deck.
I came up with another solution which was to move the epoch from which you measure the third period for the first few rounds and then play as usual |
This introduces a bit of an issue for early game failures, because you can draw a combination like 1990, 1900, 1820, for instance, and then the fourth card could be like 1901 and really mess your game up. This is a possibility any time you draw four cards from period 3 in the first 8 draws, so we'd be hitting the fallback state quite a bit. #123 would fix, but could also use this method and just change the last period to be 1700-2020, which would mean that no combination of early cards fails the tooClose check |
For reference, here's the math I did to check your new distance function, and why I think dropping back to 1700 would be appropriate if we did implement this way:
|
What is |
That column (which I've now changed) is simulating the worst case card draws. If we start with 2020 as the end of the last period and assume the 55 - 5x function for distance, and our first card draw is 1970, we rule out 100 possible years because no card can be within 50 years of 1970, so 1920 through 2020 is ruled out. And if we look at the state after 2 cards, the worst case would rule out 180 years by supposing that the first two drawn were 1975 and 1885, and now everything from 1840 to 2020 is ruled out. After 3 cards, the worst case would rule out 240 years with 1980, 1900, 1820, each ruling out 80 years each. And so on. So using this observation:
|
Thirdly, we could also change both the distance function and the epoch to something like 44 - 4x and 1780 in #122 |
I also have a concern with changing the distance function in the current MR because 55 years feels way closer together in the 12th century than it does in the 20th century |
I think probably we should just change the distance function to depend on the period we're looking at, actually. |
As pointed out in
#121, it was previously possible for duplicate years or even duplicate cards to be drawn because we'd fall back to the random card choice too often. This was because the tooClose function could return true too easily for certain circumstances.
This makes it so tooClose is slightly less strict, but also only applies that function as a second pass, meaning we should fall back to a set of relevant cards instead of the whole deck.
Closes #103, #121