Finding the Winning Strategy for Playing Gin Rummy: A Computer Simulation

CSEF · 2019 Mathematical Sciences

Overview

Objectives The objective of this study is to determine the gin rummy playing strategy with the highest likelihood of winning. Methods Computer, Python coding language. Coded a 2-player gin rummy game in which the computer plays itself, using different strategies to test and measure the effectiveness of each strategy. The playing strategies tested were: (1) Highest Card Discard (player discards highest cards in their hand), (2) Lowest Card Discard (player discards lowest cards in their hand), (3) Random (player discards any cards not part of a meld and draws randomly from the draw pile and discard pile), and (4) Learning Strategy (computer randomly picks one of the 3 strategies to play and if the player wins, continues to play that strategy for the next game, otherwise it switches strategies). Results After the computer simulates 10,000 two-player games for each match-up, the wins, ties and losses are tallied. The Lowest Card Discard strategy won the majority of games against all of the other strategies with the highest margins against Random strategy (83% vs 17% wins) and significant advantage over Highest Card Discard strategy (63% vs 36% wins) and Learning Strategy (65% vs. 35% wins). For the greatest probability of winning, the computer decides to play Lowest Card Discard strategy. Conclusions Although a commonly acknowledged winning strategy for gin rummy is Highest Card Discard (to minimize the number of high cards deductions from the total score), my program proved that the opposite strategy, Lowest Card Discard, results in a higher chance of winning. In other words, players should focus on making melds with high cards in order to maximize their total score. My program is able to test each strategy against another, in isolation, and complete 10,000 game simulations in less than 5 minutes. To replicate these results, it could take several months for people to play with regular cards, for 24 hours a day, which is not realistic. Computer simulations prove to be an effective and efficient way to test playing strategies and pinpoint the strategy with the highest chance of winning. To refine my study further, my next steps would be to add the ability to create runs (or sequential melds), add more strategies to be tested, and add the ability to change strategies in the middle of a game.

Summary statement

My computer simulations prove that discarding the lowest cards in your hand is the strategy with the highest likelihood of winning at gin rummy.

Help received

My mentor, Nathan Hutchison, a Computer Science graduate student at Santa Clara University, has been teaching me advanced Python programming and helped troubleshoot bugs over the 8 months that I worked on the program. This project, however, was entirely my idea and I wrote all of the code.

Competition history

  • CSEF 2019 Mathematical Sciences · Entry J1404

Resources

Related projects

Closest projects by meaning, across every fair and year in the corpus.

Browse more like this

Source: California Science & Engineering Fair public projects

Save projects to your library

Sign in with Google to keep track of projects you find interesting, organized into folders. An account also raises your daily allowance for “Has this been done?”, and lets you create a key for the MCP server with a much higher limit than anonymous use. Browsing stays public.

Continue with Google