Define a legal Solitaire-type move within a group of face-up playing cards as moving one card to partially cover a stationary card provided that the stationary card:
1) has numeric value exactly one larger than the card to be moved; and
2) is of a color opposite to that of the card to be moved.
Note that Jack, Queen and King have numeric values of 11, 12 and 13 respectively and Ace only has the value of 1.
-----
From 52 cards, 8 cards are randomly chosen and are laid out face up in a row. In this simplified game, the other 44 cards are discarded. What is the probability that no legal Solitaire-type move is possible for a:
a) Standard Deck, 2 suits are red and 2 suits are black.
b) One-Suit Deck: what if the 52 cards are all one suit, 4 complete sets of Ace through King, and the "opposite color" requirement is removed?
Each running of the program below does a simulation of a million trials. Five independent run outcomes are shown:
moveCt=0; moveColorCt=0;
for trial=1:1000000
had=zeros(1,52);
for card=1:8
found=false;
while found==false
c=randi(52);
if had(c)==0
found=true;
deck(card)=c;
had(c)=1;
end
end
val=mod(c,13);
if val==0 val=13;
end
deckv(card)=val;
deckc(card)=mod(c,2);
end
hadMove=false;
hadMoveWithColor=false;
for i=1:8
for j=1:8
if abs(deckv(i)-deckv(j))==1
hadMove=true;
if deckc(i)~=deckc(j)
hadMoveWithColor=true;
end
end
end
end
if hadMove
moveCt=moveCt+1;
if hadMoveWithColor
moveColorCt=moveColorCt+1;
end
end
end
disp([1-moveCt/trial 1-moveColorCt/trial])
Each run represents the frequency of no first move in one million trials, the first is for the color-free version; the second is with the color requirement.
>> solitaireNoFirstMove
0.020443 0.102045
>> solitaireNoFirstMove
0.020597 0.101702
>> solitaireNoFirstMove
0.020579 0.101896
>> solitaireNoFirstMove
0.020586 0.102319
>> solitaireNoFirstMove
0.020623 0.102136
Without the color requirement, the probability of no move is apparently between 2.0% and 2.1% but closer to the latter. With the color requirement it's about 10.2%.
|
Posted by Charlie
on 2021-01-12 10:51:48 |