Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

tom-james-watson
Copy link
Owner

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

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.
@rowboat1
Copy link
Contributor

rowboat1 commented Jul 1, 2024

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

@rowboat1
Copy link
Contributor

rowboat1 commented Jul 1, 2024

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

@rowboat1
Copy link
Contributor

rowboat1 commented Jul 1, 2024

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:

#cards distance Worst case (2*dist * #cards) epoch that avoids fallback ( min ( 1800, worst case))
0 55 0 1800
1 50 100 1800
2 45 180 1800
3 40 240 1780
4 35 280 1740
5 30 300 1720
6 25 300 1720
7 20 280 1740
8 15 240 1780
9 10 180 1800
10 5 100 1800
11 0 0 1800

@tom-james-watson
Copy link
Owner Author

What is 2020 - 2*dist * #cards supposed to represent? I don't quite follow what the table is meant to be showing.

@rowboat1
Copy link
Contributor

rowboat1 commented Jul 1, 2024

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:

@rowboat1
Copy link
Contributor

rowboat1 commented Jul 1, 2024

Thirdly, we could also change both the distance function and the epoch to something like 44 - 4x and 1780 in #122

@rowboat1
Copy link
Contributor

rowboat1 commented Jul 1, 2024

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

@tom-james-watson
Copy link
Owner Author

I think probably we should just change the distance function to depend on the period we're looking at, actually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate card in game
2 participants