3
\$\begingroup\$

Imagine there is a card game where the primary objective of the game is to get 4 of one card in your hand.

Game mechanics

Each player starts of with 10 cards in their hand. The remaining 32 cards (jokers are taken out of the deck) are put in the center.

Each turn, a player can put one of their cards (which is chosen at random) at the bottom of the deck and draw one from the top. They roll a fair, six sided die to determine how many times they do this in one turn.

Card notation

As Penguino helpfully pointed out, suite is irrelevant, so cards are numbered 1 - 13, where 1 is Ace and 13 is King.

Write a program that takes in two arguments: Each players starting hand and Number of turns and return the probability that a player will get four of the same number in your hand within n turns.

Examples to try

[[1,2,3,4,5,6,7,8,9,10],[13,12,11,10,9,8,7,6,5,4],10]

This is so fewest bytes wins!

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Thank you for the feedback. I will do this. \$\endgroup\$ Mar 5, 2022 at 20:27
  • \$\begingroup\$ As the suite of each card in the hand is completely irrelevant to the probability of getting a 4 of a kind, can you simplify the card notation to the suite-less 2,3,4...10,J,Q,K,A? or even simpler 1,2,3...10,11,12,13 \$\endgroup\$
    – Penguino
    Mar 6, 2022 at 20:36

0