PART A – CHOOSE YOUR SALARY Salary Options: You are offered two salary options for…
Get Help With Your Essay
"Place your order now for a similar assignment and have exceptional work written by our team of experts at an amazing
You are going to create a deck of cards and deal a five (5) card poker hand.
Your program should create a deck of cards, shuffle it, and then put the first five cards in the deck into a 5 element list which represents a hand. Use the functions we created together. You can (and should) import the card program we created in lecture directly. You do not need to copy and paste the code into a new program. Simply add an import statement and use the functions.
You are going to write a series of functions which take a hand (a list of 5 cards) as an input and return Boolean values that can be used to analyze this hand.
– is_high_card: should return true if there are no cards with matching faces, and the cards do not increase in value (no straight) and do not have a matching suit (no flush). This hand is also known as nothing.
– is_pair: should return true if there are exactly 2 cards of the same value
– is_2_pair: should return true if there is one set of 2 cards with a common value and a second set of 2 cards with a different common value
– is_3_of_a_kind: returns true if there are exactly 3 cards with a common value
– is_4_of_a_kind: returns true if there are exactly 4 cards with a common value
– is_full_house: returns true if there are 3 cards with a common value and the other cards share a different common value
– is_flush: if the five cards all have the same suit
– is_straight: returns true if the value of the five cards form a sequence which increases by 1 in each case. For instance (2,”hearts”). (3,”spades”), (4, “diamonds”), (5,”hearts”), (6,”clubs”)
– is_straight_flush: returns true if the value of the five cards form a sequence which increases by 1 in each case and each card has the same suit. For instance (2,”hearts”). (3,”hearts”), (4, “hearts”), (5,”hearts”), (6,”hearts”)
Your program should create a deck, shuffle it, draw a hand from the first five cards, then call each of the above functions and print out which of them return True. Do not print out information about functions that return False. Finally, the program should print the cards from the hand.
Rules and Requirements
– Your program MUST BE broken into two files.
– One file MUST BE a module that contains all the card hand assessment functions.
– The module containing the test functions file MUST BE named “card_tests.py”. If the module is named anything else, your program will instantly lose 50% credit.
– Your program that creates the deck and deals the hand and tests the hand MUST BE named “deal_and_test.py” this program should consolidate all code into functions and should run a main function as per our normal class standard. This file can have in import statement to use the functions we created in class.
– The functions used to test the cards MUST BE named as described above. If the functions are named anything else, your program will instantly lose 50% credit.
– Your functions MUST accept a list of cards (dictionaries) as input. Any function that accepts anything else will receive a zero score.
– Your functions MUST return Boolean values. Any function that returns anything else will receive a zero score.
– You MUST use the playing card structure that we produced in class. Do not change the names of the dictionary keys.
– The order of functions in the module does not matter.
– You may not use list comprehension or classes of your own creation. Any check that uses these techniques will earn zero points.
Your final submission will include three (3) files. The playing card program we created in class, your deal_and_test.py file and your card_test.py file.
Note: It is possible for multiple conditions to be met in a single hand. For instance a straight-flush is both a straight and a flush. But while three of a kind also technically contains a single pair, it should not be listed as a pair because a pair is EXACTLY two matching cards. I will be testing your program by feeding it different hands. Your functions must accurately categorize valid and invalid hands. That is to say, “is_pair” or “is_3_of_a_kind” should return True when given a pair or three of a kind respectively but False when given a full house. As a result, “is_pair” is probably the hardest function to get right.
For Extra Credit, make a third file in your program that creates two hands by alternating cards from the shuffled deck into each hand. Determine which hand wins based on the rankings of poker hands (https://en.wikipedia.org/wiki/List_of_poker_hands#Hand-ranking_categories (Links to an external site.)). You may add functions to your module of card tests but make sure the original functions still work properly and return the proper results. If you do the extra credit, your submission will include four (4) files.