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

Avoiding drawing a new card from an era that will fail the tooClose check #121

Closed
wants to merge 3 commits into from

Conversation

rowboat1
Copy link
Contributor

@rowboat1 rowboat1 commented Jun 28, 2024

The tooClose function will always hit if you draw too many early cards in the 1800-2020 range.

For instance, if you draw 1880, and then 2000, you will now cause any card in the 1800-2020 range to fail on the tooClose check on your third draw, and force a random card to be drawn.

When the tooClose function rules out all cards in a period, the game defaults to drawing a random card from the deck without any other failsafes.

One of the failsafes in tooClose is to ensure cards are at least 1 year away from any existing card. But this gets bypassed if the original check failed.

Without this failsafe, we can have ties (which fail on a coinflip, and are annoying) and in some cases even a duplicate card being drawn.

This also creates many more happy cases that preserve the intended balancing effects of avoidPeople and splitting cards into three different periods.

Should close #81 and #103 (in fact, if you look at the screenshot in #103 , you can see that they've drawn 3 cards in the 1800-2020 range during their game, likely causing this exact bug)

rowboat1 added 3 commits June 28, 2024 21:09
The tooClose function will always hit if you draw too many early cards in the 1800-2020 range

When the tooClose function rules out all cards, the game defaults to drawing a random card from the deck without any other failsafes.

One of the failsafes in tooClose is to ensure cards are at least 1 year away from any existing card.

Without this failsafe, we can have ties (which fail on a coinflip) and in some cases even a duplicate card being drawn.

We also lose all the other balancing effects of avoidPeople and splitting cards into three different periods.
@rowboat1 rowboat1 changed the title Enhancing distance function Avoiding drawing a new card from an era that will fail the tooClose check Jun 29, 2024
tom-james-watson added a commit that referenced this pull request Jul 1, 2024
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.
@tom-james-watson
Copy link
Owner

Hey

Thanks for this PR - it's definitely a good attempt at fixing a bad flaw you point out. I do find the logic a bit hard to follow though, and think it's a little unnecessarily complex.

It spurred me to make a similar, but simpler, PR that should also solve this issue: #122.

Let me know what you think of that.

@rowboat1
Copy link
Contributor Author

rowboat1 commented Jul 1, 2024

I also found my own logic confusing, and was thinking up my own improved solution, haha! Let me know what you think of #123 😄

@rowboat1 rowboat1 closed this Jul 1, 2024
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.

Exclude already seen cards
2 participants