Problem 1512. Clock Solitaire
Many card players will be familiar with the game of Clock Solitaire. Briefly, the player sets up by creating thirteen piles of four face-down cards at random, each associated with one of the ranks ace through king. Beginning with the top card in the king's pile, the player places the drawn card face up beneath its home pile, and draws a new card from the top of that same pile. Play continues until the fourth king is drawn. If all cards are face up in their home piles at this time, the game is a winner.
Since clock solitaire is a purely deterministic game, a computer can easily be programmed to play. For this problem, you will write a function that takes a deck and reports whether or not it is a winning configuration. More specifically, the input will be some permutation of the integers 1:52, where 1:13 represent the ace through king of clubs, 14:26 the ace through king of diamonds, 27:39 the hearts, and 40:52 the spades. Assume that the cards are formed into 13 piles by taking the first four cards as the ace pile, next four as the deuce pile, etc. Output is a single scalar boolean indicating whether the game will be won using this deck.
Armed with this function, one can determine empirically what the win rate is for randomly shuffled decks. See if you can find out!
Solution Stats
Problem Comments
-
1 Comment
Please add a test case that kills my invalid leading solution.
I misinterpreted the wiki page for sequencing which I thought was random choice to produce a 1 in 13 probability.
Solution Comments
Show commentsProblem Recent Solvers37
Suggested Problems
-
1756 Solvers
-
Count from 0 to N^M in base N.
235 Solvers
-
563 Solvers
-
228 Solvers
-
Getting the indices from a matrix
634 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!