sjoelee / Cards

Creating a deck of cards and then extending that to something awesome and hopefully playable.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blackjack and the use of the Deck Class

Creating a deck to hopefully create a game of Blackjack.

The idea here is to create:

  • Card class that captures the "suit" and value of the card
  • Suit class that contains a list/array of cards of the same suit
  • Deck class that contains a list/array of suits

Issue #1:

  • cannot remove an element from the top of the list because AbstractList (which is what Arrays.asList uses) creates an unmodifiable collection.
  • perhaps what should be done from the beginning is to use a List. And since List is a collection, we can use the shuffle method.
  • RESOLVED

Issue #2:

  • should Blackjack be a class which extends an abstract class of CardGame?
  • what does it mean to have a Blackjack object? Players themselves are part of this "object" and the moves allowed are what are permitted within the rules. It seems like it would make more sense if the game was an interface and not a class.
  • should Blackjack be an interface that a Blackjack Player would need to implement?
  • if it is an interface, than the player would "change" his behavior accordingly. The type of moves that are allowed would only be whatever is allowed in the interface. The Blackjack player would have to implement the interface. But how do I encode the list of moves within an interface?

About

Creating a deck of cards and then extending that to something awesome and hopefully playable.


Languages

Language:Java 100.0%