From: Ruby Quiz Date: 2008-01-11T22:56:34+09:00 Subject: [QUIZ] Counting Cards (#152) The three rules of Ruby Quiz: 1. Please do not post any solutions or spoiler discussion for this quiz until 48 hours have passed from the time on this message. 2. Support Ruby Quiz by submitting ideas as often as you can: http://www.rubyquiz.com/ 3. Enjoy! Suggestion: A [QUIZ] in the subject of emails about the problem helps everyone on Ruby Talk follow the discussion. Please reply to the original quiz message, if you can. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Learning to count cards is much easier than Hollywood or the casinos would have us believe. Some systems only require you to track a single running total in your head. One such system, called the Knock-out system of card counting, is extra easy. You start your count at 4 - (4 x number_of_decks). That gives us an initial running count of 0, -4, -20, or -28 for the common casino shoe sizes of 1, 2, 6, or 8 decks. From there, you add one each time you see a 2, 3, 4, 5, 6 or 7 and subtract one when you see a 10, jack, queen, king, or ace. The 8 and 9 cards do not affect the count. Once you learn to track the running count, you can make strategy decisions and vary your bets based on the times when the count is in your favor. That's not a lot to remember, but it does take practice to get fast. You really need to get to where you can count a deck in 20 to 30 seconds if you are going to keep up with those fast moving casinos dealers. This week's Ruby Quiz is to build a training program for helping you learn to count cards. The program needs to show you one or more cards at a time, running through a Blackjack shoe. As it goes, the program should track the running count. Have it pause at random intervals, ask you the count, and notify you if you are right or wrong. Both the time to go through the deck and the number of cards displayed at a time should be configurable. It's important to practice with seeing multiple cards at once because you learn to cancel out pairs of high and low cards. It might even be nice to provide a mixed mode, which varies the number of cards shown at a time. You can show cards as simple Strings, ASCII art, or full graphics as you prefer. You may wish to make cards fully disappear after their display time though, to make the conditions more like they would be in a casino.