mgiannini / IdiotsDelight

Play Idiot's Delight from your terminal.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

The most popular solitaire game in my family was always "Idiot's Delight". Or, at least that's what we called it. Apparently the rules we played by (and implemented in this code) are different than those I found online.

Rules

Here are the rules for my version of Idiot's Delight. The game begins with a shuffled deck of cards. You draw one card from the back of the deck and place it in your hand. Every time you draw a card, apply the reduction rules as outlined below until you can no longer reduce your hand, then draw another card.

Always put the most recently drawn card from the deck on top of your hand. Your hand is essentially a stack.

Reduction Rules

Reduction rules are always applied starting with the most recently drawn cards, working backwards as your reduce (top to bottom).

  1. If you have less than four cards in your hand, you cannot reduce anything. Draw another card from the deck.

  2. If the card on top of your hand has the same rank as the fourth card from the top of your hand, then remove the top four cards. For example:

  3. πŸ‚‘ πŸƒ… πŸ‚± πŸƒ– πŸ‚’ πŸƒ‘ (top)

  4. The first and fourth cards from the top are both aces, so remove the top four cards.

  5. πŸ‚‘ πŸƒ… (top)

  6. If the top card in your hand is the same suit as the fourth card from the top, then remove the second and third cards from the top. Apply the reduction rules again if possible.

  7. πŸ‚‘ πŸƒ… πŸ‚’ πŸƒ– πŸ‚’ πŸ‚­ (top)

  8. The first and fourth cards are both spades, so remove the six of clubs and two of spades.

  9. πŸ‚‘ πŸƒ… πŸ‚’ πŸ‚­ (top)

  10. The first and fourth cards from the top are still both spades, so re-apply the rule.

  11. πŸ‚‘ πŸ‚­ (top)

Winning

You win if you have an empty hand after drawing the last card from the deck and applying the reduction rules. If you have any cards left in your hand, you lose.

About

Play Idiot's Delight from your terminal.

License:MIT License


Languages

Language:Haskell 100.0%