class Card { } constructor (face, suit) { this.face = face this.suit = suit CARD_COUNT =...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
class Card { } constructor (face, suit) { this.face = face this.suit = suit CARD_COUNT = 52 let cards = [] faces = ["A",2, 3, 4, 5,6,7,8,9,10,"J", "Q", "K"] suits = ["Hearts", "Diamonds", "Clubs", "Spades"] class Dealer { } constructor () { this.getDeckOfCard() this.shuffle() getDeckOfCard() { for (let count = 0; count < this.CARD_COUNT; count++) this.cards [count] = new Card(this.faces [count % 13]) this.suits [Math .floor(count / 13)] shuffle() { for (let firstCard = 0; firstCard < this.CARD_COUNT; firstCard++) let secondCard = Math.floor(Math.random() * this.CARD_COUNT) let tempCard = this.cards [firstCard] cards [firstCard] = secondCard cards [secondCard] = tempCard function buildPlayingCard (card, suitIcon, faceColor, suitColor) { return `<div class="card player-card"><div class="card-title" style="text-align: left; font-size: 20px; padding-left: 10px; color: ${faceColor}">${card.face}</div><div class="card-content" style="font-size: 28px; padding-bottom: 25px; "><span class="${suitIcon)" style="color: ${suitColor}"></span></div></div> document.getElementById("btnDealCards").onclick= function myFunction() { let dealer new Dealer() dealer.shuffle() let cardOutputWithIcon - ** for (const card of cards) // or for (const card of dealer.cards) not sure if it correct { switch(card.suit) { case "Hearts": cardOutputWithIcon + buildPlayingCard(card, "mdi mdi-heart", "red", "red") //use https://pictogrammers.github.io/@mdi/font/6.9.96/ } break case "Diamonds": cardOutputWithIcon + buildPlayingCard(card, "mdi mdi-cards-diamond", "red", "red") break case "Clubs": cardOutputWithIcon + buildPlayingCard(card, "mdi mid-cards-club", "black", "black") break case "Spades": cardOutputWithIcon + buildPlaying Card (card, "mdi mid-card-spade", "black", "black") document.getElementById("result").innerHTML = cardOutputWithIcon console.log(cardOutputWithIcon) Set the CSS #player-card-container to a display of grid with four columns, a padding of 10 pixels, and a grid gap of 10 pixels Welcome to the Card Game! Return 9 + 1 5 8 0 Card Dealer Deal Cards Shuffled Cards 2 ♥ ♦ ♥ 10 0 3 > + ♥ ♦ 9 8 ♦ The result: It didn'tt come out with any err but it didn't come out with anything either. Please help! (Use javaScript) wwwwwww class Card { } constructor (face, suit) { this.face = face this.suit = suit CARD_COUNT = 52 let cards = [] faces = ["A",2, 3, 4, 5,6,7,8,9,10,"J", "Q", "K"] suits = ["Hearts", "Diamonds", "Clubs", "Spades"] class Dealer { } constructor () { this.getDeckOfCard() this.shuffle() getDeckOfCard() { for (let count = 0; count < this.CARD_COUNT; count++) this.cards [count] = new Card(this.faces [count % 13]) this.suits [Math .floor(count / 13)] shuffle() { for (let firstCard = 0; firstCard < this.CARD_COUNT; firstCard++) let secondCard = Math.floor(Math.random() * this.CARD_COUNT) let tempCard = this.cards [firstCard] cards [firstCard] = secondCard cards [secondCard] = tempCard function buildPlayingCard (card, suitIcon, faceColor, suitColor) { return `<div class="card player-card"><div class="card-title" style="text-align: left; font-size: 20px; padding-left: 10px; color: ${faceColor}">${card.face}</div><div class="card-content" style="font-size: 28px; padding-bottom: 25px; "><span class="${suitIcon)" style="color: ${suitColor}"></span></div></div> document.getElementById("btnDealCards").onclick= function myFunction() { let dealer new Dealer() dealer.shuffle() let cardOutputWithIcon - ** for (const card of cards) // or for (const card of dealer.cards) not sure if it correct { switch(card.suit) { case "Hearts": cardOutputWithIcon + buildPlayingCard(card, "mdi mdi-heart", "red", "red") //use https://pictogrammers.github.io/@mdi/font/6.9.96/ } break case "Diamonds": cardOutputWithIcon + buildPlayingCard(card, "mdi mdi-cards-diamond", "red", "red") break case "Clubs": cardOutputWithIcon + buildPlayingCard(card, "mdi mid-cards-club", "black", "black") break case "Spades": cardOutputWithIcon + buildPlaying Card (card, "mdi mid-card-spade", "black", "black") document.getElementById("result").innerHTML = cardOutputWithIcon console.log(cardOutputWithIcon) Set the CSS #player-card-container to a display of grid with four columns, a padding of 10 pixels, and a grid gap of 10 pixels Welcome to the Card Game! Return 9 + 1 5 8 0 Card Dealer Deal Cards Shuffled Cards 2 ♥ ♦ ♥ 10 0 3 > + ♥ ♦ 9 8 ♦ The result: It didn'tt come out with any err but it didn't come out with anything either. Please help! (Use javaScript) wwwwwww
Expert Answer:
Answer rating: 100% (QA)
Based on the screenshots provided it appears youre trying to display a shuffled deck of playing cards within a web page using JavaScript HTML and CSS ... View the full answer
Related Book For
Understanding Basic Statistics
ISBN: 9781111827021
6th Edition
Authors: Charles Henry Brase, Corrinne Pellillo Brase
Posted Date:
Students also viewed these programming questions
-
It has been a long-held practice that the NCAA does not believe in paying players from any sport to play or profit from the use of their name or image. Their belief has always been that student...
-
You are to program to play fish against the computer. The rules of fish can be found on many internet sites. A sample explanation of the game as taken from Wikipedia is: Five cards are dealt from a...
-
You have been selected as a team member of a new presidential council designed to repair, replenish and grow the economy, as well as, sustain the financial markets. The team is designed to take on...
-
In Exercises 3542, describe and sketch the surface given by the function. f(x, y) = Jxy, 0, x 0, y 0 x <0 or y < 0
-
A narrow beam of light is incident from air onto the surface of glass with index of refraction 1.56. Find the angle of incidence for which the corresponding angle of refraction is half the angle of...
-
Cinnabar Company has provided the following data concerning its operations for the year ended December 31, 20A: Required Prepare the cost of goods sold statement. $24,000 30,000 70,000 14,000...
-
The British statistician Ronald Fisher introduced a famous data set called Fishers Iris data set. This data set describes various physical characteristics, such as petal length and petal width (in...
-
At the beginning of the fiscal year, Andy Company purchased for $2,060,000 a patent that applies to the manufacture of a unique tamper-proof lid for medicine bottles. Andy incurred legal costs of...
-
Apple business is currently operating in the country of China and you were asked to report on different aspects of the business as you consider international expansion. By now, you should have a good...
-
In the circuit of Fig. 5.59 , calculate v o of v s = 2 V. 8 k2 2 k2 4 k2 4 k2 Vo Vs (+I) + I
-
Design a sequential circuit using SR and T flip flop inputs equation given below along with output equation as RA = QA QB\' SA = QA\' . (QB\' + X) TB = (X QA + X\' QB\' QA\') Output equation Y = QA...
-
Given a hollow ball made of an isotropic elastic material, the inner and outer surfaces of which are concentric spheres of radius a and b, respectively. Pressure pa acts in the cavity of the sphere,...
-
recommend a price and marketing strategy for the newly established automobile manufacturer seeking to enter the market for specialist competition motorcycles.compare your recommendation to those for...
-
Business Problem: We all know that Health care is very important domain in the market. It is directly linked with the life of the individual; hence we have to be always be proactive in this...
-
There are four pieces to an annuity present value. What are they? What are the differences between an ordinary annuity, an annuity due, and perpetuity? In general, what is the present value of a...
-
Consider the space truss represented schematically in Figure 1. It has 21 struts and a fixed support at "C". At joint "E", it is applied a force vector with a component of 30 N, along the x-axis, and...
-
The symmetric group S, on n symbols n>2, the set of all 3-cycles generates a subgroup of order 3 3n n! 2 n!
-
14. In testing the existence assertion, an auditor ordinarily works from the a. Financial statements to the accounting records. b. General journal to the general ledger. c. Supporting evidence to the...
-
In the airline business, on-time flight arrival is important for connecting flights and general customer satisfaction. Is there a difference between summer and winter average on-time flight arrivals?...
-
A random sample of 5222 permanent dwellings on the entire Navajo Reservation showed that 1619 were traditional Navajo hogans (Navajo Architecture: Forms, History, Distributions by Jett and Spencer,...
-
Suppose we have a binomial experiment with n = 40 trials and a probability of success p = 0.50. (a) Is it appropriate to use a normal approximation to this binomial distribution? Why? (b) Compute ...
-
Natural gas (methane) flows from a 3-in.-diameter gas main, through a 1-in.-diameter pipe, and into the burner of a furnace at a rate of \(100 \mathrm{ft}^{3} /\) hour. Determine the pressure in the...
-
SAE 30 oil at \(60^{\circ} \mathrm{F}\) flows through a 2-in.-diameter pipe with a mean velocity of \(5 \mathrm{ft} / \mathrm{s}\). Determine the value of the Reynolds number (see Example 1.4)....
-
Calculate the Reynolds numbers for the flow of water and for air through a 4-mm-diameter tube, if the mean velocity is \(3 \mathrm{~m} / \mathrm{s}\) and the temperature is \(30^{\circ} \mathrm{C}\)...
Study smarter with the SolutionInn App