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

Add Jack Variation #466

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

arunsrinivas20
Copy link

@arunsrinivas20 arunsrinivas20 commented Dec 31, 2024

If the trump number is J and the non-dealer team wins the last trick with a single jack, then the dealer team goes back to rank 2. All rank changes still apply after the rank reset occurs. It is an optional rule.

The setting is located under More Game Settings.

image

4-Player Jack Simulation

The dealer team (A, C) is at J and the non-dealer team (B, D) is at 9. The last trick is won by the non-dealer with a single jack . Without the variation enabled, the dealer team would advance to rank K (they kept the non-dealer team under 40 points).

image

After clicking Finish Game, we will see that the jack variation will kick in. The dealer team's new rank will be 4 (see the chat box in the following screenshot), since they got sent back to rank 2, but they still held the non-dealer team under 40 points. The dealer team remains dealer.

image

5-Player Simulation (1)

In this Finding Friends game, A (the dealer) is at J, B is at 9, C is at A, D is at J, and E is at J. C joins A during the game to form the dealer team. The last trick is won by the non-dealer team with a single jack. Without the variation, the ranks of A and C would be unchanged because they lost the round. B, E, or D would become the dealer. B, E, or D would advance to J, K, and K, respectively.

image

After clicking Finish Game, we will see that the jack variation will kick in. A and C are sent back to rank 2 (see the chat box in the following screenshot), while the other players' ranks match what was described above.

image

5-Player Simulation (2)

In this Finding Friends game, A (the dealer) is at J, B is at J, C is at 2, D is at K, and E is at K. B joins A during the game to form the dealer team. The last trick is won by the non-dealer team with a single jack. Without the variation, the ranks of A and B would advance to Q because they successfully defended. C, D, or E would not become the dealer and would remain at their respective ranks.

image

After clicking Finish Game, we will see that the jack variation will kick in. A and B are set to rank 3 (see the chat box in the following screenshot), while the other players' ranks remain the same. A/B is dealer for the next round.

image

- If the dealer team is on rank J and the non-dealer team wins the last trick
  with a single jack, then the dealer team's ranks will be set back to 2. This
  is applied before any rank advancements are applied.
- Works for Tractor and Finding Friends modes
- Adds a setting under "More Game Settings" to enable the variation
@arunsrinivas20
Copy link
Author

@rbtying can you review this? Let me know if I'm missing something or you need clarification on the setting.

Copy link
Owner

@rbtying rbtying left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for working on this @arunsrinivas20 ! I'm impressed you figured this all out, I don't think I've seen you contribute before.

A number of nits in the review itself - but the main thing would be to use an enum for the setting rather than a bool because I believe there are additional variants that other folks will want to have also!

@@ -238,6 +238,8 @@ impl PlayPhase {
failed_throw_size,
} = self.trick.complete()?;

println!("{:?}", self.trick.played_cards());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mind removing this? it'll clutter logs

@@ -360,6 +362,7 @@ impl PlayPhase {
landlord: (PlayerID, Rank),
advancement_policy: AdvancementPolicy,
max_rank: Rank,
lost_on_single_jack: bool,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bit unclear, I think (which team lost on a single jack?).

Perhaps we can just pass in the last trick entirely?

} = lt_played_cards.iter().find(|pc| pc.id == winner_pid).unwrap();

// In the jack variation, the last trick must be won with a single (trump) jack
return cards.len() == 1 && cards[0].number() == Some(Number::Jack);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've actually heard of multiple variants here, FWIW.

e.g. typically it's fine to win with a pair of J (i.e. triggers J->2), but not to win with HJHJ-J (b/c the winning requires the HJ)

@@ -282,6 +282,8 @@ pub struct PropagatedState {
#[serde(default)]
pub(crate) hide_throw_halting_player: bool,
#[serde(default)]
pub(crate) jack_variation: bool,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the many ways that people play the J->2 variation - do you mind making this an enum so we can add more versions later?

BackToTwoSetting {
  #[default]
  Disabled,
  SingleJackToTwo,
  // AceToTwo,
}

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.

2 participants