CSE231 Spring Updated 04/09/2019 Project 10: Basra - A Fishing Card Game

Similar documents
CSE 231 Fall 2012 Programming Project 8

Lab Exercise #10. Assignment Overview

CS Programming Project 1

CS Project 1 Fall 2017

CS 210 Fundamentals of Programming I Spring 2015 Programming Assignment 8

Project 2 - Blackjack Due 7/1/12 by Midnight

CS 210 Fundamentals of Programming I Fall 2015 Programming Project 8

CPSC 217 Assignment 3 Due Date: Friday March 30, 2018 at 11:59pm

For this assignment, your job is to create a program that plays (a simplified version of) blackjack. Name your program blackjack.py.

Activity 6: Playing Elevens

DELIVERABLES. This assignment is worth 50 points and is due on the crashwhite.polytechnic.org server at 23:59:59 on the date given in class.

After receiving his initial two cards, the player has four standard options: he can "Hit," "Stand," "Double Down," or "Split a pair.

Here are two situations involving chance:

Bridge Players: 4 Type: Trick-Taking Card rank: A K Q J Suit rank: NT (No Trumps) > (Spades) > (Hearts) > (Diamonds) > (Clubs)

Beeches Holiday Lets Games Manual

BRIDGE is a card game for four players, who sit down at a

Programming Languages and Techniques Homework 3

Go Fish (Addition facts to Ten)

CSE 231 Spring 2013 Programming Project 03

The Exciting World of Bridge

UNIT 9B Randomness in Computa5on: Games with Random Numbers Principles of Compu5ng, Carnegie Mellon University - CORTINA

CPSC 217 Assignment 3

Project 1: A Game of Greed

3. If you can t make the sum with your cards, you must draw one card. 4. Players take turns rolling and discarding cards.

Distinguishable Boxes

LESSON 2. Objectives. General Concepts. General Introduction. Group Activities. Sample Deals

CS 152 Computer Programming Fundamentals Lab 8: Klondike Solitaire

Domino Games. Variation - This came can also be played by multiplying each side of a domino.

HW4: The Game of Pig Due date: Tuesday, Mar 15 th at 9pm. Late turn-in deadline is Thursday, Mar 17th at 9pm.

ASSAULT OBJECTIVES DEPLOYMENT HEXADOME SCORING ZONE END-GAME CONDITIONS. SCENARIOS v 1.3

ECE2049: Foundations of Embedded Systems Lab Exercise #1 C Term 2018 Implementing a Black Jack game

Inheritance Inheritance

GorbyX Rummy is a unique variation of Rummy card games using the invented five suited

Roll & Make. Represent It a Different Way. Show Your Number as a Number Bond. Show Your Number on a Number Line. Show Your Number as a Strip Diagram

LEARN HOW TO PLAY MINI-BRIDGE

Programming Assignment 4

Lesson 1 - Practice Games - Opening 1 of a Suit. Board #1 None vulnerable, Dealer North

Summer Camp Curriculum

Mini Project #2: Motion Planning and Generation for a Robot Arm

Due: Sunday 13 November by 10:59pm Worth: 8%

PHASE 10 CARD GAME Copyright 1982 by Kenneth R. Johnson

COMP 9 Lab 3: Blackjack revisited

PROBLEM SET 2 Due: Friday, September 28. Reading: CLRS Chapter 5 & Appendix C; CLR Sections 6.1, 6.2, 6.3, & 6.6;

Sheepshead, THE Game Set Up

Poker Rules Friday Night Poker Club

ATeacherFirst.com. S has shown minimum 4 hearts but N needs 4 to support, so will now show his minimum-strength hand, relatively balanced S 2

Ovals and Diamonds and Squiggles, Oh My! (The Game of SET)

Acing Math (One Deck At A Time!): A Collection of Math Games. Table of Contents

FOR THE CROWN Sample Play

Welcome to the Best of Poker Help File.

TEST A CHAPTER 11, PROBABILITY

Games for Drill and Practice

{ a, b }, { a, c }, { b, c }

FALL 2015 STA 2023 INTRODUCTORY STATISTICS-1 PROJECT INSTRUCTOR: VENKATESWARA RAO MUDUNURU

Probability Homework Pack 1

How to Play WADA s Anti-Doping Card Game

GAMBLING ( ) Name: Partners: everyone else in the class

Clever Hangman. CompSci 101. April 16, 2013

Cambridge University Bridge Club Beginners Lessons 2011 Lesson 1. Hand Evaluation and Minibridge

Corners! How To Play - a Comprehensive Guide. Written by Peter V. Costescu RPClasses.com

Finite Math Section 6_4 Solutions and Hints

Begin this assignment by first creating a new Java Project called Assignment 5.There is only one part to this assignment.

1. Theoretical probability is what should happen (based on math), while probability is what actually happens.

HAND & FOOT CARD GAME RULES

CMSC 201 Fall 2018 Project 3 Sudoku

LESSON 4. Eliminating Losers Ruffing and Discarding. General Concepts. General Introduction. Group Activities. Sample Deals

Create Your Own World

LESSON 6. Rebids by Responder. General Concepts. General Introduction. Group Activities. Sample Deals

Spring 06 Assignment 2: Constraint Satisfaction Problems

Spring 06 Assignment 2: Constraint Satisfaction Problems

LESSON 6. The Subsequent Auction. General Concepts. General Introduction. Group Activities. Sample Deals

Oh Hell! - Moncton Outdoor Enthusiasts. may be changed only if the next player to the left has not yet bid.

Crapaud/Crapette. A competitive patience game for two players

Tarot Combat. Table of Contents. James W. Gray Introduction

CS107L Handout 06 Autumn 2007 November 2, 2007 CS107L Assignment: Blackjack

Battle. Table of Contents. James W. Gray Introduction

Diet customarily implies a deliberate selection of food and/or the sum of food, consumed to control body weight.

Lightseekers Trading Card Game Rules

Welcome to ARRAY and thanks for buying our game. 2 to 5 Players

Problem Set 4: Video Poker

Comprehensive Rules Document v1.1

Girls Programming Network. Scissors Paper Rock!

Lightseekers Trading Card Game Rules

Phase 10 Masters Edition Copyright 2000 Kenneth R. Johnson For 2 to 4 Players

TABLE GAMES RULES OF THE GAME

HW4: The Game of Pig Due date: Thursday, Oct. 29 th at 9pm. Late turn-in deadline is Tuesday, Nov. 3 rd at 9pm.

Muandlotsmore.qxp:4-in1_Regel.qxp 10/3/07 5:31 PM Page 1

Chapter 2 Integers. Math 20 Activity Packet Page 1

Turn this page over for your Math Homework Menu!

SALES AND MARKETING Department MATHEMATICS. Combinatorics and probabilities. Tutorials and exercises

Checkpoint Questions Due Monday, October 7 at 2:15 PM Remaining Questions Due Friday, October 11 at 2:15 PM

The Teachers Circle Mar. 20, 2012 HOW TO GAMBLE IF YOU MUST (I ll bet you $5 that if you give me $10, I ll give you $20.)

Grade 7/8 Math Circles Game Theory October 27/28, 2015

Up & Down GOAL OF THE GAME UP&DOWN CARD A GAME BY JENS MERKL & JEAN-CLAUDE PELLIN ART BY CAMILLE CHAUSSY

SEEM3460/ESTR3504 (2017) Project

CATFISH BEND CASINOS RULES OF THE GAME THREE CARD POKER

BEGINNING BRIDGE Lesson 1

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Activity 1: Play comparison games involving fractions, decimals and/or integers.

Homework Assignment #2

Transcription:

CSE231 Spring 2019 Updated 04/09/2019 Project 10: Basra - A Fishing Card Game This assignment is worth 55 points (5.5% of the course grade) and must be completed and turned in before 11:59pm on April 15, 2019. Assignment Overview: How to use a custom-built Python class. This project focuses on the design, implementation and testing of a Python program which uses an instructor-supplied module to play a card game, as described below. Assignment Background This game belongs to a category of card games called fishing cards games. It was played originally in the Middle East. A fishing game is a card game using the following mechanism. Each player in turn matches a card from their hand with one (or more) of those lying face-up on the table and then takes them. If the card which the player played out does not match one of the existing cards, it stays on the table. Table cards are picked up by the last player. There can be 2 or 4 players, but here we consider only the 2-player scenario. A standard 52-card deck is used. Initially, all cards are shuffled, then 4 cards are dealt to each player and another 4 cards are placed on the table facing up. The game depends on comparing the cards in hand to the cards on the table. Players take turns fishing, each using one card at a time as bait. If a player cannot fish any table card(s) using any of his bait (cards in hand), the player places his bait of choice (one of his cards) on the table. By placing one card on the table (a failed bait), this card becomes a table card (the bait turns to a fish). After each round (4 fishing attempts by each player), both players run out of cards and each get another 4 cards from the deck. Table cards carry over from one round to the next. The game continues until the deck is all dealt (6 fishing rounds). The winner is the one who can fish the largest number of cards (ranks do not matter in this count) and achieve the largest number of Basras (a Basra will be explained later). Game Rules: 1- Two players play the game. 2- A bait (an in-hand card) can fish any table card of the same rank (regardless of their suits). In such a case both cards are added to the players pile. For example, a 7 captures a 7, a queen captures a queen, and so on. 3- A numeric bait (an in-hand card that is neither a jack, a queen or a king) can fish multiple table cards if their ranks add up to its rank. In such a case, all of them (including the bait) are added to the player s pile. For example, if the table has 3, 4, 5 and 8 and the player has 9 in hand, the player can capture the 5 and the 4 and add both of them along with his 9 to his pile. In Basra, Aces do not receive any special treatment. An Ace is just a card whose rank is 1, nothing more. 4- Using the same card, a player can make more than one capture. For example, if the table has a 4, 6, 10 and 3 and the player has a 10 (his bait), the 10 and the 4 and the 6 from the table along with the bait (the in-hand 10) will be added to the player s pile. Or if after the initial deal the table contains two kings, a player can capture both of them using one king as bait. You can only capture pairs or singles, not combinations of more than two cards.

5- If a player plays a card (a bait) that does not match anything, it stays face up on the table, and is available for capture in future turns. 6- Queens and kings have no numerical value. A queen can capture or be captured by a queen and a king can capture or be captured by a king. The only other way to capture a queen or king is to play a special card (jack or seven of diamonds explained later). 7- A Basra occurs if a player captures all the cards from the table, leaving it empty, using an ordinary card or seven of diamonds. The card that is used to get the Basra is saved in a different place (Basra list) and depending on the type of the card played it will have different score. 8- We have 2 special cards: a. Jacks: If a jack is played when there are cards on the table, it captures all the cards from the table, leaving it empty, but this does not count as a Basra (the jack and the cards are added to the player s pile though). If it is played when the table is empty, it does not capture anything, but it remains on the table. b. The seven of diamonds: has the same property as Jacks, it captures everything on the table. If the cards on the table are all numerics, and their values add up to 10 or less, this counts as a Basra. The card (seven of diamonds) is saved in the Basra list. The other cards are added to the player s main pile. 9- After the last card has been played, any cards that remain on the table are taken by the last player. The cards are added to the player s main pile (no Basras here). Project Assignment: Before you begin to write any code, play with the game at https://www.kongregate.com/games/mhdside/basra and look over the sample interaction below to be sure you understand the rules of the game and how you will simulate the game. We will have these lists to be used during playing the game (defined in the main function): p1_cards: cards in hand of player1 p2_cards: cards in hand of player2 t_cards: cards on the table p1_pile: captured cards of player 1 p2_pile: captured cards of player 2 basra_1: captured Basras of player 1 basra_2: captured Basras of player 2 You should write the following functions: distribute_cards(deck, p1_cards, p2_cards, t_cards, round1) The round1 is a Boolean that is True if this is the first round; False otherwise. If it is round1, each cards list will start empty and be filled by this function. This function does not return anything (lists are changed because they are mutable). This function deals each player four cards:

1- If this is the first round, each player receives 4 cards and another 4 cards are placed on the table. The order of dealing is 4 cards to player 1, then four cards to player 2, and then 4 cards to the table. The deal() function from the Card class can be used to deal a card from the deck. 2- If this is not the first round, each player receives 4 cards. The order of dealing is the same: 4 cards to player 1 and then 4 cards to player 2 (no cards dealt to the table). For example: Starting Deck 10, 8, A, J, 9, J, 5, 4, 7, 9, K, 3, 7, 2, 3, A, 4, K, 9, 5, 10, 4, 6, Q, 7, 5, 8, 2, Q, 8, J, 9, 2, 3, 7, 6, Q, 5, 8, 4, 6, 3, Q, A, 10, A, K, 10, J, K, 2, 6 ---------- Testing round1. ---------- player 1 hand: [6, 2, K, J ] player 2 hand: [10, K, A, 10 ] table cards: [A, Q, 3, 6 ] ---------- Testing round2. ---------- Starting Deck: 10, 8, A, J, 9, J, 5, 4, 7, 9, K, 3, 7, 2, 3, A, 4, K, 9, 5, 10, 4, 6, Q, 7, 5, 8, 2, Q, 8, J, 9 player 1 hand: [4, 8, 5, Q ] player 2 hand: [6, 7, 3, 2 ] table cards: [] get_card_index(card,card_list) int This function returns the index of the card in the list card_list if it exists, otherwise returns None, The eq () function from the Card class can be used here (which means that you are using ==), to compare the objects. You might find enumerate() useful; it works on lists. For example: Card: 10 Card List: [6, 2, K, J, 10, K, A, 10, A, Q ] Card Index: 7 ---------- Testing card not in the list. ---------- Card: 3 Card List: [6, 2, K, J, 10, K, A, 10, A, Q ] Card Index: None get_matching_cards(card, t_cards) list This function finds if there are any similar cards on the table to the playing card (card). The matching cards should have the same rank. It should return a list of the matching cards. If no matching cards on the table, return an empty list. The equal_value() function from the Card class can be used here. For example: ---------- Testing only one card on the table. ---------- Card: 2 Table Card List: [6, 2, K, J, 10, K, A, 10, A, Q, 3, 6 ] Instructor matching Cards: [2 ] Student matching Cards: [2 ]

---------- Testing more matching cards on the table ---------- Card: 6 Table Card List: [6, 2, K, J, 10, K, A, 10, A, Q, 3, 6 ] Instructor matching Cards: [6, 6 ] Student matching Cards: [6, 6 ] numeric_card(card) Boolean This function checks if the card is numeric card (rank is <= 10) not picture card, rank() function from the Card class can be used here. It will return True if the card is numeric, otherwise return False. A card is numeric if its rank is less than 11. For example: ---------- Testing if numeric. ---------- Card: 6 Output: True ---------- Testing if not numeric ---------- Card: K Output: False remove_cards(cards_list,cards) This function removes a list of cards (cards) from another list of cards cards_list. This function doesn t return anything it modifies cards_list. The get_card_index()function can be used here along with the remove() method of a list. This function will be called by almost all the functions in the project. For example, it will be used to remove cards from: 1- Remove matching cards from a table list: remove_cards(t_cards, matching_cards) 2- Remove one card from both players lists: remove_cards(player_list,[card]) For example: ---------- Testing removing only one card. ---------- Card: 2 Starting Player Cards: [6, 2, K, J ] Ending Player Cards: [6, K, J ] ---------- Testing removing card not in the list. ---------- Card: 2 Starting Player Cards: [6, K, J ] Ending Player Cards: [6, K, J ] ---------- Testing removing many matching cards ---------- Cards: [6, 6 ] Starting Table Cards: [6, 2, K, J, 10, K, A, 10, A, Q, 3, 6 ] Ending Table Cards: [2, K, J, 10, K, A, 10, A, Q, 3 ] ---------- Testing removing many cards not in the list---------- Cards: [6, 6 ] Starting Table Cards: [2, K, J, 10, K, A, 10, A, Q, 3 ] Ending Table Cards: [2, K, J, 10, K, A, 10, A, Q, 3 ]

get_sum_matching_cards(card,t_cards) list This function is provided to you in the starter code. It finds pairs of cards (or singletons) on the table that add up to the value of card. The rank() function is used and compared to all summations of any two cards on the table. This function returns a list of cards that add up to card s rank. If the card is a Jack, Queen or King, the function returns an empty list. sum_rank(card_list) int (optional) This optional function computes the sum of cards values in the card_list. The rank() function should be used. For example, Table Cards: [6, 2, K, J ] Sum_rank = 6 + 2 + 13 + 11 = 32 jack_play(card,player,pile,basra,t_cards) This function is called when the playing card (card) is a Jack. This function doesn t return anything. If the table (t_cards) is empty, the Jack card should be appended to the empty table list (t_cards) and removed from the player list (player). If the table is not empty, 1. a Jack card captures all cards on the table (t_cards) and adds them to the player s pile (pile). 2. After completing step 1 we have to put the Jack card someplace: o if the starting table only had a Jack (or all Jacks), this card will be Basra, and should be added to player s Basra list (basra). o else the Jack card should be added to the player s pile 3. The Jack card then should be removed from the player list (player). For example, ---------- Testing empty table. ---------- Starting table cards: [] Starting player hand: [6, 2, K, J ] Starting player pile: [] Starting player Basra: [] Card to play: J Ending table cards: [J ] Ending player hand: [6, 2, K ] Ending player pile: [] ---------- Testing with cards on table not all jacks. ---------- Starting player hand: [6, 2, K, J ] Starting table cards: [10, K, A, 10 ] Card to play: J Ending player hand: [6, 2, K ] Ending player pile: [10, K, A, 10, J ]

---------- Testing with all jacks on table. ---------- Starting player hand: [6, 2, K, J ] Starting table cards: [J, J, J ] Card to play: J Ending player hand: [6, 2, K ] Ending player pile: [J, J, J ] Ending player Basra: [J ] seven_diamond_play(card,player,pile,basra,t_cards) This function is called when the playing card (card) is 7D (seven of diamonds). This function doesn t return anything. If the table is empty, the 7D card should be appended to the table list (t_cards) and removed from the player s hand line (player). If the table is not empty, 1. the 7D card captures all cards on the table (t_cards) and adds them to the player s pile (pile). 2. If the values of the cards on the table add up to <=10: a. This 7D card will be Basra, and should be added to player s Basra list (basra). b. else the 7D card should be added to the player s pile (pile).. 3. The card then should be removed from the player s hand list (player). For example, ---------- Testing empty table. ---------- Starting player hand: [J, 5, 4, 7 ] Card to play: 7 Ending player hand: [J, 5, 4 ] Ending player pile: [] Ending table cards: [7 ] ---------- Testing with cards on table not all numerics. ---------- Starting player hand: [J, 5, 4, 7 ] Starting table cards: [6, 2, K, J ] Card to play: 7 Ending player hand: [J, 5, 4 ] Ending player pile: [6, 2, K, J, 7 ] ---------- Testing with all numeric cars on table and sum>10. ---------- Starting player hand: [J, 5, 4, 7 ] Starting table cards: [3, 7, 2, 3 ] Card to play: 7 Ending player hand: [J, 5, 4 ] Ending player pile: [3, 7, 2, 3, 7 ] ---------- Testing with all numeric cars on table and sum<=10. ---------- Starting player hand: [J, 5, 4, 7 ] Starting table cards: [2, 3, A, 4 ] Card to play: 7 Ending player hand: [J, 5, 4 ]

Ending player pile: [2, 3, A, 4 ] Ending player Basra: [7 ] play(card,player,pile,basra,t_cards) This function checks the value of the playing card with other cards on the table (t_cards). This function will be used by both players. This function doesn t return anything. 1- If there are no cards on the table, the card will be added to the table list (t_cards) and remove card from player list (player) 2- If the card is a Jack (rank is 11), the jack_play() function is called. 3- If the card is 7D (seven of diamonds: rank is 7 and suit is 2), the function seven_diamond_play() is called. 4- If the card is a King or Queen (rank is > 11): a. Find all matching cards on the table, the get_matching_cards()should be used. i. If no matching cards, the card should be appended to the table (t_cards). ii. If there are matching cards, the matching cards will be removed from the table (t_cards) and moved to the player s main pile (pile). 1. If the table becomes empty after removing them, this counts as Basra, and the bait (the in-hand card) is added to the Basra list of the player (basra). 2. If the table is not empty after deletion, then the card will be added to the player s main pile (pile) as a regular capture. b. and remove card from player list (player) 5- If the card is a numeric card, find the matching cards and the matching sum of cards. get_matching_cards() and get_sum_matching_cards() should be used. a. If there are matching cards, both lists of cards should be removed from the table and added to player s pile if they are not empty. i. If the table became empty, this counts as Basra, and the bait should be added to the Basra list (basra), otherwise, it will be added to player s main pile (pile) as a regular capture. b. If both lists are empty, no matching or sums on the table, then the card is added to the table for future use. c. and remove card from player list (player) For example, ---------- Testing empty table no jack no 7D. ---------- Starting player hand: [J, 5, 4, 7 ] Card to play: 5 Ending player hand: [J, 4, 7 ] Ending player pile: [] Ending table cards: [5 ] ---------- Testing with cards on table and jack card played. ---------- Starting player hand: [6, 2, K, J ] Starting table cards: [J, J ] Card to play: J

Ending player hand: [6, 2, K ] Ending player pile: [J, J ] Ending player Basra: [J ] ---------- Testing with cards on table and 7D played. ---------- Starting player hand: [J, 5, 4, 7 ] Starting table cards: [3, 7, 2, 3 ] Card to play: 7 Ending player hand: [J, 5, 4 ] Ending player pile: [3, 7, 2, 3, 7 ] ---Testing with picture card played and matching cards on table. --- Starting player hand: [6, 2, K, J ] Starting table cards: [K, K ] Card to play: K Ending player hand: [6, 2, J ] Ending player pile: [K, K ] Ending player Basra: [K ] ---Testing with numeric card played, with matching cards on table. --- Starting player hand: [8, 4 ] Starting table cards: [7, A, 8, 4 ] --round 1-- Card to play: 8 Ending player hand: [4 ] Ending player pile: [8, 7, A, 8 ] Ending table cards: [4 ] --round 2-- Card to play: 4 Ending player hand: [] Ending player pile: [8, 7, A, 8, 4 ] Ending player Basra: [4 ] compute_score(p1_pile,p2_pile,basra_1,basra_2) int,int This function takes the four lists as parameters and computes the score of each player. A tuple (player1_score, player2_score) is returned. 1- The player that has the majority of the cards (27 or more) scores 30 points. 2- If both have exactly the same number of cards, both get 0. 3- Each numeric Basra scores 10. 4- King or Queen Basras score 20. 5- Jack Basra scores 30. For example, ---------- Testing draw game. ---------- Player 1 cards: 26 cards Player 2 cards: 26 cards Player 1 basra: [] Player 2 basra: [] Instructor scores: 0 and 0 Students scores: 0 and 0

---------- Testing p1 has more cards but no basras. ---------- Player 1 cards: 27 cards Player 2 cards: 25 cards Player 1 basra: [] Player 2 basra: [] Instructor scores: 30 and 0 Students scores: 30 and 0 ---------- Testing same # of cards, p1 with basras but not p2. ---------- Player 1 cards: 26 cards Player 2 cards: 26 cards Player 1 basra: [K, J, 5 ] Player 2 basra: [] Instructor scores: 60 and 0 Students scores: 60 and 0 ---------- Testing same # of cards with both has basras. ---------- Player 1 cards: 26 cards Player 2 cards: 26 cards Player 1 basra: [K ] Player 2 basra: [J, 5 ] Instructor scores: 20 and 40 Students scores: 20 and 40 ---------- Testing p1 cards are more with both has basras. ---------- Player 1 cards: 32 cards Player 2 cards: 10 cards Player 1 basra: [K, J ] Player 2 basra: [3, K ] Instructor scores: 80 and 30 Students scores: 80 and 30 display_table(t_cards,p1_cards,p2_cards) This function is provided to you. It displays the game table main() A game consists of six rounds where players alternate turns until their hands are empty (no cards). The first round begins with 4 cards dealt to each hand and 4 cards dealt to the table (i.e. 12 cards). Each subsequent round begins with 4 cards dealt to each hand (no cards dealt to the table, i.e. 8 cards). There will be 8 turns in each round (each player has 4 cards and each turn plays one card from their hand). After six rounds there are no more cards in the deck to be dealt so the game ends. (Hint: this is your basic control structure for the game.) Your program must meet the following specifications. The program begins by offering a welcome message and displays the rules of the game. Then, the player is asked to play or not. This control is provided in the starter code provided. Here is what you need to add: 1. Create an object of Deck class. 2. Initialize all player lists to all zeros. 3. Prompt the user if he wants to play or not. The only acceptable answers are n or y. Capitalization does not matter. The program should keep asking the player for a valid input.

4. If the player wants to play, the deck is shuffled 5. Then, the game starts. You will need a while loop to play the game (this will be in addition to the while loop in the provided code that is used to ask whether the user wants to play another game). What Boolean expression should control this loop? 6. Cards dealt to the table and players for the first round subsequent rounds do not deal to table. 7. At the start of each round, the number of cards left in the deck and the game table are displayed. 8. For each player s turn, the program should prompt the user for the index of the card he wants to play. The index should be >= 0 and less than the length of the player list. The program should keep asking the player for a valid card index. Then, the play() function is called. 9. Any player can quit the game at any point. To quit the game, the player should enter q when asked for a card index. When the player quits the game, the program should display a goodbye message. 10. After each player takes a turn display the game. 11. For each round, each player should receive 4 cards each time until there is no cards left in the deck. 12. Play alternates between the two players. Use a variable to keep track of who is playing. 13. At the end of a round, if the table is not empty, the last player takes all the cards on the table. Display the game to show that the table is now empty. 14. The game ends when the deck is empty. The player who has the highest score is the winner. 15. When the game has come to its conclusion, the program should output whether player1 or player2 won. It then should ask the user whether to play again. 16. If the user selects to play again, your program should. All the lists should be reinitialized and the deck should be reset. The reset() function should be used. 17. If the user chooses not to play the game again, the program should display a goodbye message. Assignment Deliverables The deliverable for this assignment is the following file: Proj10.py the source code for your Python program Be sure to use the specified file name and to submit it for grading via the Mimir system before the project deadline. Assignment Notes 1. We provide a module called cards.py that contains a Card class and a Deck class. Your program must use this module (import cards). Do not modify this file! and do not upload it to Mimir! 2. Laboratory Exercise #10 demonstrates how to use the cards module. Understanding those programs should give you a good idea how you can use the module in your game. 3. We have provided a starter code named proj10.py to get you started. Using this code is mandatory. It runs as is, but does nothing useful. Gradually replace the pass code (marked with comments) with your own code. (Delete the pass code.)

Test Cases: Test 1: Test 2: Test 3: Test 4: Grading Rubric General Requirements: 4 pts Coding Standard 1-9 (descriptive comments, source code Headers, function headers, etc...) Function Tests: 4 pts distribute_cards() 2 pts get_card_index() 5 pts get_matching_card() 2 pts numeric_card() 2 pts remove_cards() 5 pts jack_play() 5 pts seven_diamond_play() 5 pts play() 5 pts compute_score() Program Tests 4 pts Test1 4 pts Test2 4 pts Test3

4 pts Test4