Question
BlackJack This game is played between a player and a dealer. (In this exercise there is only one player - you.) Each person (player, dealer)
BlackJack This game is played between a player and a dealer. (In this exercise there is only one player - you.) Each person (player, dealer) draws two cards with each card's face counting towards a player's score. Picture cards: Jack, queen, and king count 10. Other cards count whatever number displays. The object of the game is to get as close to 21 points as possible without going over 21. (Going over 21 points is called 'BUSTING'.) The first one to bust looses that hand. 21 is the best score. After looking at your initial 2 cards, you can choose to improve your score by taking an additional card. This is known as "taking a hit". That card is added to your total. Most players have a hidden rule that they go by, such as "I must take a hit on 17 or under." You can take hits repeatedly until you bust, or get close enough to 21. Once the player Stops taking hits, the dealer can take a series of hits. If the dealer busts, you win. If not, you compare scores and the highest score wins. To make this 'game' easier to program, here are a few simplying rules for our simulation: 1.) Assume an endless deck - don't worry about 52 cards or the same card being drawn twice. 2.) An ACE always has a value of 1 (one) rather 1 or 11. 3.) Don't worry about double downs or blackjack. 4.) Dealer must hit at 16 or under. 5.) Dealer can't hit at 17 or over. 6.) Player is prompted for the number that is their limit. 7.) Nobody wins ties. 8.) Keep a running total of the player's score and the dealer's score. You and Your Team Must Plan It out on Paper First !! This is the deliverable for project 1. For Project 2, you will implement the design as specified in project 1. Some ideas for functions and procedures are: RANDOM function or package - picks a random number --- 2 examples are given to you PX procedure - prints stars for separation PL procedure - to save typing DBMS_OUTPUT.PUT_LINE GET_SUIT function - Use a random number from 1 - 4 to return one of four suits ('Hearts', 'Clubs', etc..) GET_CARD_NAME function - turns a 1 into an ACE, a 2 into TWO, 11 into Jack, 12 into Queen, etc.. NORMALIZE function - to convert jacks, queens, and Kings into a value of ten DRAW procedure - used by a player or dealer to draw a card CHECK_BUSTED function - see if anyone has a score over 21 ... you get the idea ... Example of desired output, using the execution of a script from the operating system: SQL> @objack1 Enter value for player_limit: 17 ******************************* Dealer's turn: Drew a Ten of Diamonds That's worth 10 points . The total is now: 10 points. ******************************* Player's turn: Drew a Five of Spades That's worth 5 points. . The total is now: 5 points. ******************************* Dealer's turn: Drew a Four of Hearts That's worth 4 points. . The total is now: 14 points. ******************************* Player's turn: Drew a Seven of Clubs That's worth 7 points. . The total is now: 12 points. ****************************** Dealer's turn: Drew a Seven of Hearts That's worth 7 points. . The total is now: 21 points ****************************** Player's Turn: Drew an Eight of Spades That worth 8 points. . The total is now: 20 points. ****************************** Dealer won. What a Shame. Oh well, Play again. This is to get you started: --------------------------------------------------------------------------------------------------------------- DECLARE p_score number := 0; -- Player's score - declare variables BEFORE D_score number := 0; -- Dealer's score - procedures and functions P_Limit number := &Player_Limit; -- The highest number the player is -- willing to draw against. Seed number := 8; Seed2 number := 5; Function Random (N number) -- Local function picks a random number return number -- not *really* random, just fakes it is begin For i in 1...63987 loop null; end loop; Seed := (mod(to_number(to_char(sysdate, 'SS'))+Seed+Seed2+P_Limit, N)+1); Return (seed); end; Submit all of the scripts and output files to blackboard in 1 single winzip file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started