The Poker Squares Challenge Todd W. Neller. What is the Poker Squares Challenge? A semester-long contest where Gettysburg College students (individuals.

Slides:



Advertisements
Similar presentations
The Poker Squares Family: cards, letters, and hexes Todd W. Neller.
Advertisements

Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
CSE 332: Lab 6 overview Overview of Lab 6 Your Lab 6 program will –Correct a glitch in the lab 5 specification Use exceptions only for abnormal flow control.
Games & Adversarial Search Chapter 5. Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent’s reply. Time.
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
Chapter 8 Counting Principles: Further Probability Topics Section 8.3 Probability Applications of Counting Principles.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
CS 484 – Artificial Intelligence
Games CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Selective Search in Games of Different Complexity Maarten Schadd.
Probability – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Probability Reading: Kolman, Section 3.4.
Great Theoretical Ideas in Computer Science.
Chapter 3b Counting Rules. Permutations  How many ways can 5 students in a class of 30 be assigned to the front row in the seating chart?  There are.
This time: Outline Game playing The minimax algorithm
1 Discrete Math CS 280 Prof. Bart Selman Module Probability --- Part a) Introduction.
Games with Chance Other Search Algorithms CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 3 Adapted from slides of Yoonsuck Choe.
Midterm Review Solutions Math 210G-04, Spring 2011.
1 search CS 331/531 Dr M M Awais A* Examples:. 2 search CS 331/531 Dr M M Awais 8-Puzzle f(N) = g(N) + h(N)
Game-Playing Read Chapter 6 Adversarial Search. Game Types Two-person games vs multi-person –chess vs monopoly Perfect Information vs Imperfect –checkers.
Combinatorics. If you flip a penny 100 times, how many heads and tales do you expect?
1 Section 5.1 Discrete Probability. 2 LaPlace’s definition of probability Number of successful outcomes divided by the number of possible outcomes This.
Intro to Probability & Games
How computers play games with you CS161, Spring ‘03 Nathan Sturtevant.
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
End of Chapter 8 Neil Weisenfeld March 28, 2005.
double AlphaBeta(state, depth, alpha, beta) begin if depth
Game-Playing Read Chapter 6 Adversarial Search. State-Space Model Modified States the same Operators depend on whose turn Goal: As before: win or win.
Dice Games Properly Presented Todd W. Neller. What’s Up With the Title? My favorite book on dice games: – Many games – Diverse games – Well-categorized.
1 The game of poker You are given 5 cards (this is 5-card stud poker) The goal is to obtain the best hand you can The possible poker hands are (in increasing.
The Parameterized Poker Squares EAAI NSG Challenge
1 Adversary Search Ref: Chapter 5. 2 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans.
UNIT PLAN PROBABILITY AND STATISTICS FOR 9 th AND 10 th GRADE By EVANS ASUBONTENG.
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
1 9/8/2015 MATH 224 – Discrete Mathematics Basic finite probability is given by the formula, where |E| is the number of events and |S| is the total number.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Lecture 5 Note: Some slides and/or pictures are adapted from Lecture slides / Books of Dr Zafar Alvi. Text Book - Aritificial Intelligence Illuminated.
Brian Duddy.  Two players, X and Y, are playing a card game- goal is to find optimal strategy for X  X has red ace (A), black ace (A), and red two (2)
Game Playing.
1 9/23/2015 MATH 224 – Discrete Mathematics Basic finite probability is given by the formula, where |E| is the number of events and |S| is the total number.
Poker Solutions.
Game Rules Rules define game objects and define allowable actions by the players.
Upper Confidence Trees for Game AI Chahine Koleejan.
Agents that can play multi-player games. Recall: Single-player, fully-observable, deterministic game agents An agent that plays Peg Solitaire involves.
Mark Dunlop, Computer and Information Sciences, Strathclyde University 1 Algorithms & Complexity 5 Games Mark D Dunlop.
Counting Subsets of a Set: Combinations Lecture 31 Section 6.4 Wed, Mar 21, 2007.
1 ECE-517 Reinforcement Learning in Artificial Intelligence Lecture 7: Finite Horizon MDPs, Dynamic Programming Dr. Itamar Arel College of Engineering.
Game-playing AIs Part 1 CIS 391 Fall CSE Intro to AI 2 Games: Outline of Unit Part I (this set of slides)  Motivation  Game Trees  Evaluation.
Homework Homework due now. Reading: relations
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Quiz 4 : Minimax Minimax is a paranoid algorithm. True
Adversarial Search Chapter Games vs. search problems "Unpredictable" opponent  specifying a move for every possible opponent reply Time limits.
Adversarial Games. Two Flavors  Perfect Information –everything that can be known is known –Chess, Othello  Imperfect Information –Player’s have each.
Introduction Lecture 25 Section 6.1 Wed, Mar 22, 2006.
Game Procedures Who does what, where, when, and how?
Pedagogical Possibilities for the 2048 Puzzle Game Todd W. Neller.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
GOMOKU ALGORITHM STUDY MIN-MAX AND MONTE CARLO APPROACHING
Stat 35b: Introduction to Probability with Applications to Poker Outline for the day: 1.Expected value. 2.Heads up with AA. 3.Heads up with Gus vs.
Probability and statistics - overview Introduction Basics of probability theory Events, probability, different types of probability Random variable, probability.
Texas Holdem A Poker Variant vs. Flop TurnRiver. How to Play Everyone is dealt 2 cards face down (Hole Cards) 5 Community Cards Best 5-Card Hand Wins.
Optimal Play of the Farkle Dice Game
Sequential Placement Optimization Games: Poker Squares, Word Squares, and Take It Easy! Todd W. Neller Abstract: In this talk, we teach how to play “Poker.
PENGANTAR INTELIJENSIA BUATAN (64A614)
C ODEBREAKER Class discussion.
Expectimax Lirong Xia. Expectimax Lirong Xia Project 2 MAX player: Pacman Question 1-3: Multiple MIN players: ghosts Extend classical minimax search.
The Birds of a Feather Research Challenge
The Parameterized Poker Squares EAAI NSG Challenge
Kevin Mason Michael Suggs
Term Project: Poker Game
Unit II Game Playing.
Presentation transcript:

The Poker Squares Challenge Todd W. Neller

What is the Poker Squares Challenge? A semester-long contest where Gettysburg College students (individuals and/or teams) compete to develop the best time-limited Poker Squares playing program. Outline: – Learn how to play – Play – Discuss strategy – Present possible computational approaches – Contest details

Poker Squares Materials: – shuffled standard (French) 52-card card deck, – paper with 5-by-5 grid, and – pencil Each turn, a player draws a card and writes the card rank and suit in an empty grid position. After 25 turns, the grid is full and the player scores each grid row and column as a 5-card poker hand according to the American point system.

American Point System Poker HandPointsDescriptionExample Royal Flush100 A 10-J-Q-K-A sequence all of the same suit 10 , J , Q , K , A  Straight Flush75 Five cards in sequence all of the same suit A , 2 , 3 , 4 , 5  Four of a Kind50 Four cards of the same rank 9 , 9 , 9, 9 , 6 Full House25 Three cards of one rank with two cards of another rank 7 , 7 , 7 , 8, 8  Flush20 Five cards all of the same suit A, 2, 3, 5, 8 Straight15 Five cards in sequence; Aces may be high or low but not both 8 , 9 , 10, J , Q  Three of a Kind10 Three cards of the same rank 2 , 2, 2 , 5 , 7  Two Pair5 Two cards of one rank with two cards of another rank 3, 3 , 4 , 4 , A  One Pair2 Two cards of one rank 5 , 5, 9 , Q , A High Card0 None of the above 2 , 3 , 5 , 8, Q 

Scoring Examples

Let’s Play! Poker HandPointsDescriptionExample Royal Flush100 A 10-J-Q-K-A sequence all of the same suit 10 , J , Q , K , A  Straight Flush75 Five cards in sequence all of the same suit A , 2 , 3 , 4 , 5  Four of a Kind50 Four cards of the same rank 9 , 9 , 9, 9 , 6 Full House25 Three cards of one rank with two cards of another rank 7 , 7 , 7 , 8, 8  Flush20 Five cards all of the same suit A, 2, 3, 5, 8 Straight15 Five cards in sequence; Aces may be high or low but not both 8 , 9 , 10, J , Q  Three of a Kind10 Three cards of the same rank 2 , 2, 2 , 5 , 7  Two Pair5 Two cards of one rank with two cards of another rank 3, 3 , 4 , 4 , A  One Pair2 Two cards of one rank 5 , 5, 9 , Q , A High Card0 None of the above 2 , 3 , 5 , 8, Q 

Strategy Discussion

Possible Computational Approaches Rule-based: hard code an algorithm (e.g. decision tree) for the placement of cards – Example: Place cards so as to maximize potential column flushes and row rank repetitions Simple Monte Carlo: – For each possible play, shuffle remaining cards and simulate a number of random/rule-based playouts. – Choose the play that yields the best average result. More complex Monte Carlo play is possible.

Structure of the Game The game is structured as an alternating sequence of chance nodes and player choice nodes. – Each card draw is a probabilistic event where any remaining card is drawn with equal probability. – Each player action is a commitment to a card placement. choice chance

Expectimax Example Assume: – all chance events are equiprobable – numbers indicate node utility (e.g. score) What is the expected value of the root chance node? choice chance

Expectimax Example Assume: – all chance events are equiprobable – numbers indicate node utility (e.g. score) What is the expected value of the root chance node? choice chance

Expectimax Example Assume: – all chance events are equiprobable – numbers indicate node utility (e.g. score) What is the expected value of the root chance node? choice chance

Expectimax Example Assume: – all chance events are equiprobable – numbers indicate node utility (e.g. score) What is the expected value of the root chance node? choice chance

Game Tree Size How big is the Poker Squares game tree? – Root chance node: 52 possible cards – 52 depth-1 choice nodes: 25 possible placements – 52x25 depth-2 chance nodes: 51 possible cards – 52x25x51 depth-3 choice nodes: 24 possible placements –…–… – 52!/27! x 25! = 52!/(27x26)  1.15x10 65 nodes – Although: Different draw/play sequences can lead to the same state. Rows/columns may be reordered without affecting score. – Still, we will not be able to evaluate entire expectimax trees except for much smaller end-game situations.

Static Evaluation Another approach: optimize static evaluation – Static evaluation: a measure of the relative goodness/badness of a partially filled grid. – Simple depth-1 greedy play: place a card so as to achieve the best static evaluation of the resulting board – More generally, compute depth-n expectimax for small n, using static evaluation at the depth limit. – Still, n must remain small for fast tree evaluation.

Monte Carlo Sampling We can reduce the branching factor and evaluate more deeply and approximately by sampling. Chance events and/or actions may be sampled: – At each chance node, average a sample drawn from the given probability distribution. – At each choice node, maximize a sample of the possible actions. However, we’d like to sample better plays more often to discern which is the best.

Monte Carlo Tree Search (MCTS) Monte Carlo Tree Search details are beyond the scope of this talk, but – UCT is a popular form of MCTS: L. Kocsis, C. Szepesvari. Bandit based Monte- Carlo Planning.Bandit based Monte- Carlo Planning. – Richard Lorentz has recently had success adapting UCT to a game with similar structure: R. Lorentz. An MCTS Program to Play EinStein Würfelt Nicht! Figure from

Combining Static Evaluation and MCTS One can also combine the ideas of static evaluation and MCTS by – Limiting depth of MCTS playouts, and – Using static evaluations instead of terminal evaluations Many different approaches are possible – The better the static evaluation, the less the need for tree search. – Perfect static evaluation  use simple greedy play!

Contest Details From download: – Card.java: basic card object – PokerSquares.java: game simulator, player tester – PokerSquaresPlayer.java: simple player interface – RandomPokerSquaresPlayer.java: random player Run RandomPokerSquaresPlayer to see random game. Run PokerSquares to see RandomPokerSquaresPlayer test. – Mean score: 14.4, standard deviation: 7.6 Each game is limited to 1 minute. A player taking longer than 1 minute on a game scores 0 for that game.

2013 Contest Timeline Mid-semester trial contest: – Submissions due March 8 th, results available after break. End-semester contest: – Submissions due Friday, April 26 th, results available on Monday, April 29 th. Submissions via to – Include “Poker Squares” in subject –.zip file with all necessary code. At the beginning of each of your class names, use a unique identifier (e.g. your username). 1 st place prize: $100 and a pair of deluxe Copag plastic playing card decks.

Be Encouraged Don’t let the complexity of some of these approaches discourage you from trying. This is an open problem; the best approach is unknown. Remember the KISS principle. Recall that random play has a mean score of 14.4 with a standard deviation of 7.6. A very simple player of mine with a 15-line getPlay method has a mean score of 81.1 with a standard deviation of Can you guess what it does? Be curious. Pursue more than a transcript. Who knows what could happen as a result? Possible follow-on projects: – Published smartphone app – Published research paper – Broader Poker Squares competition website

Resources and References Gettysburg College Poker Squares Page: – References – Rules and play grids – Contest code Monte Carlo Tree Search (MCTS): – L. Kocsis, C. Szepesvari. Bandit based Monte-Carlo Planning.Bandit based Monte-Carlo Planning. – MCTS application to similar problem: R. Lorentz. An MCTS Program to Play EinStein Würfelt Nicht!