Due: Fri. 27, 2009 CS 480 Spring 2009 Dr. Duric Homework #2 (30p) In your second homework you will start wrting a program for playing a popular card game called 'Texas Hold'em Poker'. If you are not familiar with the game full rules can be found here: http://boardgames.about.com/cs/poker/a/texas_rules.htm In the first part of your assignment you will learn the rules of the game. You do not need to play it, but it might help you if you do. We do not recommend that you spend the time playing the game to become really good, only to learn the rules. As you can see in a game each player has two face-down cards ('hole cards') and can also make use of the three 'communal' cards which are available to all players. Each player can combine their own cards and the communal cards to make a hand. Hand strengths can be seen here: http://boardgames.about.com/cs/poker/a/poker_hands.htm Note that if two players have equivalent hands they are compared by the relative strengths of the cards in those hands. For example, a pair of Queens is stronger than a pair of 8s. After you have learned the rules of the game you will start implementing a program for playing the game. You will implement the following functions first: 1. (15p) You will first write a RandomShuffle function that will take a deck of cards in the format ((Card1 Suit1) (Card2 Suit1) ... (Card1 Suit2) ... (Card1 Suit3) (Card14 Suit4)) where Card1-Card14 is the sequence (A 2 3 4 5 6 7 8 9 10 J Q K) and Suit1-Suit4 is the sequence (Spades Diamonds Hearts Clubs) [See for example http://en.wikipedia.org/wiki/Suit_(cards)] The function will return a random sequence of 52 card pairs. The easiest way to implement the function is to choose an index into the deck sequence at random and move that card (pair) from the deck into the new 'shuffled' deck, and then repeat. You should create a deck separately and pass it as an argument to your function. That will simplify your work later. In addition, use the length of the sequence to be shuffled as a local variable. 2. (15p) A Dealer function will take a random sequence of cards and a number indicating how many players are in the game, say 1-10, and return a proper deal. The deal should include a. A list of pairs of the hole cards for each player. b. Discards pile c. Five communal cards in the order they were dealt The function should return a list whose elements are the lists representing (a), (b), and (c). Note that we will deal with the betting rules later. Instructions for submission: ---------------------------- (1) Using script or dribble, you are to capture the output of a Lisp session in which you successfully load and execute your code, showing sufficient testing of your function(s). (2) Send a SINGLE email to zduric@cs.gmu.edu formatted in the following way: - the subject field of the email should read: CS480 HW#2 Duric - the content of the email should be : (a) a cover sheet containing: Your name CS480 Spring 2009 Dr. Duric Homework #2 (A short summary stating whether you were successful, describing any problems, etc.) (b) a commented version of the Lisp code for HW2. Comments at the top should include: Your name CS480 Spring 2009 Dr. Duric Homework #2 (c) a printout of a captured Lisp session involving the execution of the HW2 Lisp code As a safety precaution, always CC yourself when you submit homework this way and keep it around until it has been graded and returned.