Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ITP 168 - Introduction to MATLAB Fall 2018 Homework 7: Blackjack Setup In this homework, we will be playing the classic casino game of Blackjack.
ITP 168 - Introduction to MATLAB Fall 2018 Homework 7: Blackjack Setup In this homework, we will be playing the classic casino game of Blackjack. We will accomplish this by creating a single function file with several local functions. The function file should contain the following functions: 1. BJackjack function (main function) 2. 3. 4. 5. 6. Initdeck function Shuffle function Dealcard function Calcscore function Printcard function The main function should have the header information immediately after the help line To play the game, we will make use of a card structure. The card structure is as follows Card Structure o Attribute: Suit Type: String value " Description: Holds the card's suit o Attribute: Value Type: String value Description: Holds the card's value (Ace, 2, 3...) . - o Attribute: Number Type: Numeric value Description: Holds the card's point value (2, 3, 4...) - Blackjack is played like this: 1. The player and dealer each get two cards. a. If the player and dealer's cards each add up to 21, then no one wins. This is called a "Push" If the player's cards add up to 21, and the dealer's do not, then the player wins. This is "Blackjack" b. C. If the players' cards add up to less than 21 and the dealer's add up to 21, the player loses. This is also "Blackjack" If neither the player's cards nor the dealer's cards, add up to 21, then the game moves on to step 2 d. Page 1 of 8 ITP 168 - Introduction to MATLAB Fall 2018 Homework 7: Blackjack Setup In this homework, we will be playing the classic casino game of Blackjack. We will accomplish this by creating a single function file with several local functions. The function file should contain the following functions: 1. BJackjack function (main function) 2. 3. 4. 5. 6. Initdeck function Shuffle function Dealcard function Calcscore function Printcard function The main function should have the header information immediately after the help line To play the game, we will make use of a card structure. The card structure is as follows Card Structure o Attribute: Suit Type: String value " Description: Holds the card's suit o Attribute: Value Type: String value Description: Holds the card's value (Ace, 2, 3...) . - o Attribute: Number Type: Numeric value Description: Holds the card's point value (2, 3, 4...) - Blackjack is played like this: 1. The player and dealer each get two cards. a. If the player and dealer's cards each add up to 21, then no one wins. This is called a "Push" If the player's cards add up to 21, and the dealer's do not, then the player wins. This is "Blackjack" b. C. If the players' cards add up to less than 21 and the dealer's add up to 21, the player loses. This is also "Blackjack" If neither the player's cards nor the dealer's cards, add up to 21, then the game moves on to step 2 d. Page 1 of 8
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