Closed mrmikemcguire closed 8 years ago
So, there's kind of a chain of methods to walk back from.
table.addCard(...)
gets called by the Dealer instance when you call dealer.deal(...)
, which takes the 'top' card off the deck with deck.unshift()
.
The dealer.deal(...)
method is in turn called in game.turn()
, when the user's choice is 'hit'. Game passes in the player to deal to, the deck to deal from, and the table on which to place the card.
$card = $('<img>')
creates a new jQuery object that isn't part of the DOM (the HTML on the page) yet. I think I may have messed up, it might need a forward slash added like <img />
. When you call this.$board.append() and pass it the newly created card, that object will be inserted into the DOM.
Here are a couple exampled of what I'm doing there: http://stackoverflow.com/questions/8013792/how-to-create-a-new-img-tag-with-jquery-with-the-src-and-id-from-a-javascript-o
I realized it might not be clear that the card that get's passed into addCard is one of the card objects defined in deck.js.
I get that deck.js creates an array of card objects, but it doesn't ever use the word "card." That gets done in this area:
Dealer.prototype = { deal: function (player, deck, table) { card = deck.unshift();
I guess that leads me to my question about using the unshift() function without a parameter.
Mike McGuire
Director of EdTech
Computer Science Dept. Chair
Mullen High School
(303) 761-1764 Ext. 3411
“Educating in the Lasallian Tradition”
On Tue, Oct 27, 2015 at 10:11 AM, Gabe Sullice notifications@github.com wrote:
I realized it might not be clear that the card that get's passed into addCard is one of the card objects defined in deck.js.
— Reply to this email directly or view it on GitHub https://github.com/mrmikemcguire/Blackjack/issues/3#issuecomment-151553759 .
This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, contact the sender by reply email and destroy all copies of the original message
P Please consider the environment before printing this e-mail.
Whoops, you found a typo :), that should be deck.shift().
@gabesullice
What does card consist of exactly? In my original program, I had this line: var card = ""; Is that what needs to come back into the files you committed?
You have this line: $card = $(''); Is that shorthand for my longer line above?