blackjack.packages package¶
Submodules¶
-
class
Card(input_card)¶ Class of a single card in a traditional deck of 52 cards. Cards are 2 - 10 and have a value matching their integer name. or the are a ‘face’ card (Jack, Queen, King) and valued at 10. Ace cards are valued at 1 or 11 depending on the state of the rest of the
hand.Parameters: input_card (tuple) – A 3-value tuple composed of: card_name : string
The name of the card from the traditional set of playing cards.- suit : string
- One of (‘H’, ‘D’, ‘C’, ‘S’) representing the four possible suits.
- orig_loc : int
- The card’s original location in the shoe at “construction” time
-
card_name¶ string
The “rank” of given card instance
-
suit¶ string
The “suit”
-
orig_loc¶ int
The integer representing the location in the original shoe, before any shuffling
-
value¶ int
The integer value (from 1 - 11) of a card’s worth in the game of Blackjack.
-
assign_value()¶
-
flip_ace()¶ For imposing a new vaule if the status of the game requires it.
-
class
Dealer(shoe)¶ Bases:
blackjack.packages.player.PlayerA subclass of the class Player, with a method to determine if he hits or not in a given situation.
-
hits()¶
-
-
class
Player(shoe)¶ The hand of cards for a given player
- shoe : Instance of Shoe Class
- The current shoe initialized in Blackjack.sitting()
-
hand_of_cards¶ list
A list of cards in the current hand.
-
max_target_score¶ int
A constant set to 21 per the rules of blackjack
-
status¶ dict
- A dictionary of bools, representing:
- “bj” : Score a Blackjack? “bust” : Bust(go over 21) yet? “interested” : Interested in receiving another card when offereds
-
get_card()¶ Gets a new card from the shoe
-
pretty_output()¶ Creates a string of the current cards for output
-
score()¶ Calculates the current score of the hand
-
update_status()¶ Updates a players status based on score of current hand_of_cards
Returns: As evidence of executing Return type: True
-
class
User(shoe)¶ Bases:
blackjack.packages.player.PlayerA subclass of the class Player, with a method to determine if he hits or not in a given situation.
-
hits()¶
-
-
class
Shoe(num_decks=1)¶ A shoe of cards made out of a number of traditional decks. User will be asked for the number of decks to put in the shoe.
Parameters: num_decks (int) – The number of decks supplied by the user. Defaults to 1 deck. -
num_decks¶ int
Number of 52 card decks to use
-
cards¶ list
List of instances of card object returned by the constructor method
-
__len__()¶ Overloading Builtin: Assigns the value of len(list of cards) to the length of the object
-
cards_left()¶ Not currently accessed by any part of the script, other than the testing suite.
Returns: The length of list that is self.cards Return type: int
-
constructor()¶ - Builds a shoe of playing card decks. Each card in a given deck
- will be unique.
-
cards list
A list of the cards currently available to the players
-
suits¶ list
A list of strings reprsenting the 4 suits possible in a deck
Returns: A list of cards that is a (num_decks) multiple of standard 52 card decks. Return type: list
-
hand_out_card()¶ Takes the top card, aka the last card in the list of cards and removes it from the list and returns it.
Returns: Based on success of execution. Return type: bool
-
merge_sort(lst)¶ Not currently accessed by any part of the script, other than the testing suite.
Parameters: lst (list) – A list of “orderable” objects. Returns: A new list of the same elements - sorted. Return type: list
-
shuffle_shoe()¶ Shuffles the order of the cards in the list that constitues the shoe.
Returns: For evidence of exectution Return type: True
-