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

48.67% Correct | 51.33% Incorrect
Last Solution submitted on Dec 31, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers37

Suggested Problems

More from this Author11

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!