Closed danielgwj closed 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..
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
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?
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
So the plan is to have player and dealer inherit from a player class?
@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)
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.
I wrote what I said here (I wrote only "models"): https://github.com/matsuish/Blackjack-11
I'm actually looking into it and it looks good I've actually made some changes to it so it works now
Are you fine if I made a pull request with all the changes? Including yours @matsuish
Sure
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.
Also, what was the reasoning behind taking out the List called rows in the blackjack class?
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?
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.
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
OK. Sounds good.
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?
you could if you need to
The game needs to be initialized