Opponent Hand Estimation in the Game of Gin Rummy

Opponent Hand Estimation in the Game of Gin Rummy

PRELIMINARY PREPRINT VERSION: DO NOT CITE The AAAI Digital Library will contain the published version some time after the conference. Opponent Hand Estimation in the Game of Gin Rummy Peter E. Francis, Hoang A. Just, Todd W. Neller Gettysburg College ffranpe02, justho01, [email protected] Abstract can make a difference in a game play strategy. We conclude In this article, we describe various approaches to oppo- with a demonstration of a simple deterministic application of nent hand estimation in the card game Gin Rummy. We our hand estimation that produces a statistically significant use an application of Bayes’ rule, as well as both sim- advantage for a player. ple and convolutional neural networks, to recognize pat- terns in simulated game play and predict the opponent’s Gin Rummy hand. We also present a new minimal-sized construction for using arrays to pre-populate hand representation im- Gin Rummy is one of the most popular 2-player card games ages. Finally, we define various metrics for evaluating played with a standard (a.k.a. French) 52-card deck. Ranks estimations, and evaluate the strengths of our different run from aces low to kings high. The object of the game is to estimations at different stages of the game. be the first player to score 100 or more points accumulated through the scoring of individual hands. Introduction The play of Gin Rummy, as with other games in the In this work, we focus on different computational strate- Rummy family, is to collect sets of cards called melds. gies to estimate the opponent’s hand in the card game Gin There are two types of melds: “sets” and “runs”. A set Rummy, i.e. to evolve probabilistic beliefs about an oppo- is 3 or 4 cards of the same rank, e.g. f3|; 3~; 3♠}, nent’s hidden cards. Hand estimation in Gin Rummy is par- or fK|;K~;K♠;K}g.A run is 3 or more cards ticularly challenging because of the little information avail- of the same suit in sequence, e.g. f5|; 6|; 7|g, or able, the unknown strategy of the opponent, and the stochas- f9~;T ~;J~;Q~;K~g. Melds are disjoint, i.e. do not tic nature of the game. share cards. The origins of the melding card game Gin Rummy Cards not in melds are referred to as deadwood. Cards (McLeod 2020) are debated: some believe the game have associated point values with aces being 1 point, face stemmed from 19th-century whiskey poker, while others dis- cards being 10 points, and other number cards having points agree and say the game Conquian makes more sense as its according to their number. Deadwood points are the sum of ancestor. Although Gin Rummy was one of the most popu- card points from all deadwood cards. Players play so as to lar card games of the 1930’s and 1940’s (Parlett 2008, 2020) reduce their deadwood points. and remains one of the most popular standard deck card For each hand of a game, the dealer deals 10 cards to each games (Ranker 2020; BoardGameGeek.com 2020), it has player. (There are different systems for deciding the next received relatively little Artificial Intelligence (AI) research dealer; we will simply start with a random dealer and al- attention. ternate players as dealer across the entire game.) After the We explore variations of previous strategies used on other deal, the remaining 32 cards are placed face down to form a games, as well as develop some new approaches. These al- draw pile, and the top card is turned face-up next to the draw gorithms differ in the way simulated game data was ab- pile to form the discard pile. The top of the discard pile is stracted to make future predictions. The application of called the upcard. Bayes’ rule and the use of simple and convolutional neu- In a normal turn, a player draws a card, either the upcard ral networks allows us to see how different constructions or the top of the draw pile, and then discards a card. The lead to different estimation powers. In the process of devel- player may not discard a drawn upcard but may discard a oping a useful image for convolution-based deep learning card drawn face down. For the first turn, play starts with the and pattern recognition, we introduce the idea of an ambi- non-dealer having the option to take the first turn by drawing superpermutation, as well as prove minimal length proper- the upcard. If the non-dealer declines this option, the dealer ties. We also introduce various metrics of evaluating the suc- is given the option. If both decline, the non-dealer must take cess of a hand estimation, and show one way this estimation the first turn drawing from the draw pile. Copyright c 2021, Association for the Advancement of Artificial In the event that the hand has not ended after a turn with Intelligence (www.aaai.org). All rights reserved. only 2 cards remaining in the draw pile, nothing is scored, all cards are shuffled, and the hand is replayed with the same the given card can be melded in more sets or runs, then dealer. the value is increased, which means that there is a higher After a player has discarded, if that player’s hand has 10 chance of getting that specific meld. AI Factory hand esti- or fewer deadwood points, that player may knock, i.e. end mation also assumed that if the opponent discarded a card the hand. (Often this is indicated by discarding face-down.) or refused to pick up a face up card then all neighbour- The hand is then scored as follows: The knocking player dis- ing cards (cards of the same rank and cards of the same plays melds and any deadwood. Next, if any deadwood was suit with adjacent rank) are less likely to be in opponent’s displayed, the non-knocking player may reduce their dead- hand. Respectively, if the opponent picked up the face up wood by laying off cards, i.e. adding cards to the knock- card, then the neighbouring cards are more likely to be in ing player’s melds. Then, the non-knocking player displays opponent’s hand. Therefore, probability of each card start- melds and any remaining deadwood. ing with a midpoint probability of 0.5 will be scaled up or If the knocking player had no deadwood, they score a down accordingly to the opponent’s decision. For exam- 25-point gin bonus plus any opponent deadwood points. If ple, when an opponent is discarding a 6~, the probabili- the knocking player had less deadwood than their opponent, ties of adjacent cards 5~ and 7~ decrease. However, the they score the difference between the two deadwood totals. fact that the opponent might have a meld consisting of 7~ Otherwise, if the knocking player had greater than or equal is not taken into account. Thus, the AI Factory approach to their opponent’s deadwood points, the opponent scores a does not provide flexibility for different player strategies. 25-point undercut bonus plus the difference between the two deadwood totals. Proposed Algorithms A player scoring a total of 100 or more points wins the game. There are multiple ways to approach opponent hand estima- tion and we show three different models. What is common Prior Work between the algorithms is their data-driven design: each uses play data from a large sampling of simulated games. There have been several approaches to estimate the oppo- nent’s hand in imperfect information card games. We pro- Bayesian Estimation from Abstracted Play Data vide two works that differs completely in their complexity of computation during the game. One of our novel approaches began as an attempt to take a heuristic approach to opponent hand estimation and derive • DeepStack Approach. DeepStack (Moravcˇ´ık et al. 2017) a similar approach that is Bayesian and play data driven. was used to solve Heads-Up No-Limit Poker (HUNL) While the algorithm is not specified in (Rollason 2007), an which, similarly to Libratus (Brown and Sandholm 2018), opponent drawing a face-up card increases the estimated was able to beat professional human poker players. The probability of having same rank or adjacent suit cards, and DeepStack approach is to calculate Counterfactual Regret similarly, an opponent discarding a card or refusing a face Minimization (CFR+) to find a mixed strategy that ap- up card decreases the probability. proximates a Nash Equilibrium strategy in order to maxi- mize the expected utility. First, it runs the CFR+ algorithm Our approach begins with Bayes’ Rule and its simple pro- for a limited moves ahead. Then, later in the game Deep- portional form: Stack uses two different neural networks to approximate P (BjA)P (A) the counterfactual value of the hand (one after the flop and P (AjB) = one after each turn), which were were trained beforehand, P (B) so that it does not to re-run the CFR+ algorithm. Since the counterfactual value of the hand is recalculated after each P (AjB) / P (BjA)P (A) turn, DeepStack does not need to save the whole strategy Here A represents the atomic sentence that the opponent throughout the game, and instead performs continual re- holds a specific card, and P (A) is the probability that the solving. A similar implementation for Gin Rummy would opponent holds that card. Event B is an observation of an be too time intensive for our goals, since DeepStack’s na- opponent’s draw and discard behavior on a single turn.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us