mrmikemcguire / Blackjack

1 stars 6 forks source link

Alternating people to deal to #6

Open mrmikemcguire opened 8 years ago

mrmikemcguire commented 8 years ago

@gabesullice I'm trying to have the program alternate players to deal to, but I'm not understanding something. Assuming just a dealer and one player, when dealer.deal() in called here: this.dealer.deal(this.players[this.curPid], this.deck, this.table), is it passing a card to players[1], the sole player's array/hand... or.... does this line in the dealer.deal() - player.hand.push(card) - add the card to some other array? In a related question, is the dealer player[0]? players[0]?

gabesullice commented 8 years ago

Yes, the dealer is stored in the players property as player 0.

gabesullice commented 8 years ago

this.dealer.deal(this.players[this.curPid], this.deck, this.table) passes the player instance defined at the current index to the deal method. Then, within the deal method, that players .hand property, an array, has the card pushed onto it. This really has no effect on the HTML, but is just there to maintain the state of the players hand.

mrmikemcguire commented 8 years ago

Last question of the day, I promise...:) Where will I put the loop to deal two cards per person to start? (I'm thinking of an initialDeal() function.) Calling game.turn() more than once simply deals both cards to player[1].

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 2:00 PM, Gabe Sullice notifications@github.com wrote:

this.dealer.deal(this.players[this.curPid], this.deck, this.table) passes the player instance defined at the current index to the deal method. Then, within the deal method, that players .hand property, an array, has the card pushed onto it. This really has no effect on the HTML, but is just there to maintain the state of the players hand.

— Reply to this email directly or view it on GitHub https://github.com/mrmikemcguire/Blackjack/issues/6#issuecomment-151626021 .


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.

gabesullice commented 8 years ago

I hadn't thought of something like that. That feels like a parameter to the deal function though. It also makes me thing that perhaps Game should have a turnCount property. so that you can do something like:

if (this.turnCount === 0) {
  for (var p in this.players) {
    this.dealer.deal(2, this.playsers[p], this.deck, this.table);
  }
  // other init logic
}
gabesullice commented 8 years ago

Would you have time for a screen share some time?

mrmikemcguire commented 8 years ago

Sorry about the slow response, but my wife just got home from a professional development workshop, so I've been Mr. Mom...

[image: Inline image 1]

​I'm free tomorrow morning from 8-11:30am - does that work for you?​

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 4:09 PM, Gabe Sullice notifications@github.com wrote:

Would you have time for a screen share some time?

On Tue, Oct 27, 2015 at 2:42 PM Mike McGuire notifications@github.com wrote:

Last question of the day, I promise...:) Where will I put the loop to deal two cards per person to start? (I'm thinking of an initialDeal() function.) Calling game.turn() more than once simply deals both cards to player[1].

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 2:00 PM, Gabe Sullice notifications@github.com wrote:

this.dealer.deal(this.players[this.curPid], this.deck, this.table) passes the player instance defined at the current index to the deal method. Then, within the deal method, that players .hand property, an array, has the card pushed onto it. This really has no effect on the HTML, but is just there to maintain the state of the players hand.

— Reply to this email directly or view it on GitHub <

https://github.com/mrmikemcguire/Blackjack/issues/6#issuecomment-151626021

.


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.

— Reply to this email directly or view it on GitHub < https://github.com/mrmikemcguire/Blackjack/issues/6#issuecomment-151637763

.

— Reply to this email directly or view it on GitHub https://github.com/mrmikemcguire/Blackjack/issues/6#issuecomment-151660130 .


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.

gabesullice commented 8 years ago

What about 8-830 Thursday?

mrmikemcguire commented 8 years ago

Sounds great! AM, right?

On Oct 27, 2015, at 9:52 PM, Gabe Sullice notifications@github.com wrote:

What about 8-830 Thursday?

— Reply to this email directly or view it on GitHub.


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.

gabesullice commented 8 years ago

yep

On Wed, Oct 28, 2015 at 4:55 AM Mike McGuire notifications@github.com wrote:

Sounds great! AM, right?

On Oct 27, 2015, at 9:52 PM, Gabe Sullice notifications@github.com wrote:

What about 8-830 Thursday?

— Reply to this email directly or view it on GitHub.


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.

Reply to this email directly or view it on GitHub https://github.com/mrmikemcguire/Blackjack/issues/6#issuecomment-151799852 .