Skip to content

fundamentals-of-programming-pt-1-unit-project-matthew-and-lathe created by GitHub Classroom

Notifications You must be signed in to change notification settings

BaseCampCoding/fundamentals-of-programming-pt-1-unit-project-matthew-and-lathe

Repository files navigation

Blackjack and more! Matt's and Lathe's card game program.

Mission Statement

You have entered the casino with $100. Your goal is to turn that into $2500 dollars by playing blackjack. Good luck.

Basic Description and Background

This program originally was intended to only feature the classic card game "Blackjack". However, since development was ahead of schedule, we decided to add two more card games before the deadline, turning it into a Casino simulator. The game now has 3 main games: Blackjack, Minipoker, and Memory. The game also features 4 different dealers: Billy, Karen, Lathe, and Matt. Each dealer has their own dialogue, and play each of the games different. Billy and Karen tend to be reckless, while Lathe and Matt are more cautious. The game also incorperates a betting system, with the player having to meet a different minimum bet for different dealers. Of course, if the player cannot meet any of the minimum bets, the game will end.

Technical Information

blackjack.py

This file serves as the run file for the program. It imports in most of the other modules in the program, and then begins the main game loop. First, it calls the hello_player function, serving as the main greeting and introduction. It then initializes some important variables, and begins the outer loop. The next function call (choose_dealer) is for the player to choose what dealer they want to play with (or if they want to exit the game), and the function returns this choice. If they chose to exit the game, this is also where the break happens. This is also where the game determines what card game the player wants to play (choose_game). Next, we begin the inner game loop. First, the game establishes the minimum bet, depending on what dealer was chosen earlier, then begins the I/O bet (get_bet). Next, the game chooses what gamemode to play, depending on what the player chose just a moment ago, and passes in what dealer was selected under the variable name "difficulty". Once the game concludes, the game determines who won, and modifies the player's total money based on their bet, and if they won or not. Finally, the player is presented with option to leave the table, or continue at the current one. Note the checks throughout the game to be sure the player has not gone for broke.

cards.py

This file holds the various functions related to decoration and generating cards. "colored_text" uses escape sequences to print different texts in the game with different colors. "show_cards" splits up the multi-line strings that visually represent the cards, and then prints them side-by-side. "make_deck" uses inner and outer for loops to assemble a deck, and return it as a 2D list. "print_card" takes in information of the format that "make_deck" returns, and turns it into a string. "get_hand_value" is used in the Blackjack game itself to determine a hand's worth based on the actual rules.

doclear.py

This is the smallest file, but stores two very important functions. "clear" is used to wipe the terminal clean, making it so the game is not one long pile of text, but instead, transitions between 'screens'. "RepresentsInt" is used to make sure a value (generally an input) is indeed an integer, and not something we can't use.

gameloop.py

This file stores the actual game of Blackjack. Following the primary function "play_game", the game first establishes some important lists: hands, display_hands, dealer_hands, display_dealer_hands, and real_dealer_hands. hands and dealer_hands are used to store the functional data of the cards in play, display_hands and real_dealer_hands are used for storing the face of the cards, and display_dealer_hands are used to show the back of your opponent's cards. This is also the point the deck is made. Next, the player and dealer are both given two hands. Next, a loop is performed, presenting the player to "Hit" (ask for another card) or "Stand" (let the dealer have their turn). Note that if the player's hand ever goes over the value of 21, they bust. The next loop has the dealer make choices (dealer_ai), and also visually shows them gaining cards. This is also where the dealer will sometimes 'talk'. Finally, the two's hands are compared, and the one with a value greater than the others, but not greater than 21, wins the game.

greeting.py

This file is for all introductory functions. "hello_player" serves as the opening screen, with the title "Blackjack" shown in large letters. "choose_dealer" shows the casino's basic layout, while also running a validation loop for the player to select a table to sit at. "get_bet" runs a validation loop to be sure the player makes a bet that not only meets the minimum, but one they can afford. "choose_game" allows the player to select what card game they wish to play with their selected dealer.

memory_game.py

This file was written by Lathe. The main function is "main_memory_game". First, the preset cards are initialized. Then, they are ran through a random.choice function call, and shuffled. Next, the function branches off, depending on the dealer, but the flow is the same. The player is shown two (or four) cards, and then they are quickly removed from view. Next, the user prompted to enter in the name of the cards they seen in order. Finally, the program let's them know whether they successfully remembered the cards.

Proposal.md

This file contains our initial proposal to Nate clark on what we expected to have done.

tableart.py

This file simply contains a string that serves as an image of the casino.

threecard.py

This file contains the game of "Minipoker", an adaptation of Poker, written by Matthew. First, just like the Blackjack game, the hands for both the player and dealer are initialized. However, now each player are given 3 cards instead of 2. Next, a loop is ran that gets the player's choices of cards they wish to discard while also presenting the basics of the game. Next, the player's choices are applied to their hand (replace_cards), then the dealer makes their choices (dealer_ai), and finally, their hands' values are compared.

About

fundamentals-of-programming-pt-1-unit-project-matthew-and-lathe created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages