cs361-W16 / Blackjack-11

0 stars 2 forks source link

Initializing Game #4

Closed danielgwj closed 8 years ago

danielgwj commented 8 years ago

The game needs to be initialized

danielgwj commented 8 years ago

There's something quite interesting with our design, so we decided that the Player and Dealer will inherit from the BlackJack abstract class right?

What I've come to notice is that each of the classes (Player and Dealer) might have their own decks.

Are you guys alright with that? It wouldn't affect much in terms of gameplay..

danielgwj commented 8 years ago

Okay, it seems that making buildeck for each Dealer and Player class didnt work.

I just built my deck in the game class and its working now

matsuish commented 8 years ago

player and dealer should share the same deck, so I think we need to change our UML. I think we can make BlackJack class not parent class for player/dealer but a wrapping class for the game. I mean we can create GamePlayer class as an abstract class for player/dealer, and in BlackJack class, we can create instances of player/dealer. So BlackJack class has deck, player, dealer, and other member valuables. when calling hit() or something, we can pass deck to player/dealer like "player.hit(deck)".

I think this is simple and not so big change. What do you think?

danielgwj commented 8 years ago

I think that's a good idea with the GamePlayer class being the abstract class for player and dealer. I'll look into it right now

jrotithor commented 8 years ago

So the plan is to have player and dealer inherit from a player class?

danielgwj commented 8 years ago

@matsuish I actually implemented it such that the player and dealer is sharing one deck that is created within the BlackJack game. Do you still want to change it?

Because in the code available now, player hit would look like this

rows.get(1).add(deck.get(deck.size()-1))
deck.remove(deck.size()-1)

And dealer hit would look like this

rows.get(0).add(deck.get(deck.size()-1))
deck.remove(deck.size()-1)
matsuish commented 8 years ago

If it works, I am fine. but when sharing deck within BlackJack class, since player and dealer is now children of BlackJack class, there can be only player( or dealer) class instance. which means we cannot use the other class's variables/methods. I am wondering how we can solve this.

matsuish commented 8 years ago

I wrote what I said here (I wrote only "models"): https://github.com/matsuish/Blackjack-11

danielgwj commented 8 years ago

I'm actually looking into it and it looks good I've actually made some changes to it so it works now

danielgwj commented 8 years ago

Are you fine if I made a pull request with all the changes? Including yours @matsuish

matsuish commented 8 years ago

Sure

jrotithor commented 8 years ago

Hi, I have a question about hit. Do you want me to make 2 separate hit functions, one for the dealer and one for the player? That seems like the easiest way.

jrotithor commented 8 years ago

Also, what was the reasoning behind taking out the List called rows in the blackjack class?

jrotithor commented 8 years ago

Sorry for the barrage of questions, but what does the "stand" function in the GamePlayer class do? is it the same as the "stay" function?

danielgwj commented 8 years ago

We changed the design a bit as Shotaro pointed out that there was no way to do any inheriting from the BlackJack class. (it wasn't clean)

And we took the list out because it wasn't properly handled in the last implementation.

The old lists are just lists within the BlackJack game... Right now, the dealer has a list for himself and the player has a list for himself.

danielgwj commented 8 years ago

and i would say that stand would be stay, I googled and they are used interchangeably...but to be on the safe side you should ask @matsuish

jrotithor commented 8 years ago

OK. Sounds good.

jrotithor commented 8 years ago

I have another question. Right now, the dealer uses the same hit function as the player, but if the player is to split, the hit function would have to change to incorporate both of the player's card stacks. should I create a separate hit function if the player has decided to split, so as to not mess with the functionality of the dealer?

danielgwj commented 8 years ago

you could if you need to