Image Credit: Giphy
Let's break it down into smaller parts
Image Credit: Giphy
Let's break it down into classes
public class Card{
}
public class Card{
//Attributes
private String suit;
private String name;
private int value;
}
public class Card{
//Attributes
private String suit;
private String name;
private int value;
//Getters
public String getSuit(){ return suit; }
public String getName(){ return name; }
public int getValue(){ return value; }
}
public class Card{
//Attributes & Getters ...
}
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
}
}
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
this.suit = a_suit;
}
}
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
this.suit = a_suit;
this.name = a_number + "";
this.value = a_number;
}
}
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
this.suit = a_suit;
this.name = a_number + "";
this.value = a_number;
}
}
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
this.suit = a_suit;
if(){
}else{
this.name = a_number + "";
this.value = a_number;
}
}
}
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
this.suit = a_suit;
if(a_number == 1){
}else{
this.name = a_number + "";
this.value = a_number;
}
}
}
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
this.suit = a_suit;
if(a_number == 1){
this.name = "Ace";
this.value = 11;
}else{
this.name = a_number + "";
this.value = a_number;
}
}
}
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
this.suit = a_suit;
if(a_number == 1){
this.name = "Ace";
this.value = 11;
}else if (a_number == 11){
this.name = "Jack";
this.value = 10;
}else if (a_number == 12){
this.name = "Queen";
this.value = 10;
}else if (a_number == 13){
this.name = "King";
this.value = 10;
}else{
this.name = a_number + "";
this.value = a_number;
}
}
}
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
this.suit = a_suit;
if(a_number == 1){
this.name = "Ace";
this.value = 11;
}else if (a_number == 11){
this.name = "Jack";
this.value = 10;
}else if (a_number == 12){
this.name = "Queen";
this.value = 10;
}else if (a_number == 13){
this.name = "King";
this.value = 10;
}else{
this.name = a_number + "";
this.value = a_number;
}
}
}
import java.lang.IllegalArgumentException;
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
if(!(a_suit.equals("Spades") || a_suit.equals("Hearts") ||
a_suit.equals("Clubs") || a_suit.equals("Diamonds"))){
throw new IllegalArgumentException("The suit must...");
}
if(a_number < 1 || a_number > 13){
throw new IllegalArgumentException("The card...");
}
this.suit = a_suit;
if(a_number == 1){
this.name = "Ace";
this.value = 11;
}else if (a_number == 11){
this.name = "Jack";
this.value = 10;
}else if (a_number == 12){
this.name = "Queen";
this.value = 10;
}else if (a_number == 13){
this.name = "King";
this.value = 10;
}else{
this.name = a_number + "";
this.value = a_number;
}
}
}
import java.lang.IllegalArgumentException;
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
if(!(a_suit.equals("Spades") || a_suit.equals("Hearts") ||
a_suit.equals("Clubs") || a_suit.equals("Diamonds"))){
throw new IllegalArgumentException("The suit must...");
}
if(a_number < 1 || a_number > 13){
throw new IllegalArgumentException("The card...");
}
this.suit = a_suit;
if(a_number == 1){
this.name = "Ace";
this.value = 11;
}else if (a_number == 11){
this.name = "Jack";
this.value = 10;
}else if (a_number == 12){
this.name = "Queen";
this.value = 10;
}else if (a_number == 13){
this.name = "King";
this.value = 10;
}else{
this.name = a_number + "";
this.value = a_number;
}
}
}
import java.lang.IllegalArgumentException;
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
...
}
}
import java.lang.IllegalArgumentException;
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
...
}
}
import java.lang.IllegalArgumentException;
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
...
}
public String toString(){
return this.name + " of " + this.suit;
}
}
import java.lang.IllegalArgumentException;
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
...
}
@Override
public String toString(){
return this.name + " of " + this.suit;
}
}
import java.lang.IllegalArgumentException;
public class Card{
//Attributes & Getters ...
public Card(String a_suit, int a_number){
...
}
@Override
public String toString(){
return this.name + " of " + this.suit;
}
}
public class Deck{
}
public class Deck{
private Card[] card_deck;
}
public class Deck{
private Card[] card_deck;
public Deck(){
}
}
public class Deck{
private Card[] card_deck;
public Deck(){
this.card_deck = new Card[52];
}
}
public class Deck{
private Card[] card_deck;
public Deck(){
this.card_deck = new Card[52];
String[] suits = {"Spades", "Hearts", "Diamonds", "Clubs"};
for(String suit : suits){
}
}
}
public class Deck{
private Card[] card_deck;
public Deck(){
this.card_deck = new Card[52];
String[] suits = {"Spades", "Hearts", "Diamonds", "Clubs"};
for(String suit : suits){
for(int i = 1; i <= 13; i++){
this.card_deck[??] = new Card(suit, i);
}
}
}
}
public class Deck{
private Card[] card_deck;
public Deck(){
this.card_deck = new Card[52];
String[] suits = {"Spades", "Hearts", "Diamonds", "Clubs"};
int card_number = 0;
for(String suit : suits){
for(int i = 1; i <= 13; i++){
this.card_deck[card_number] = new Card(suit, i);
card_number++;
}
}
}
}
public class Deck{
private Card[] card_deck;
public Deck(){
this.card_deck = new Card[52];
String[] suits = {"Spades", "Hearts", "Diamonds", "Clubs"};
int card_number = 0;
for(String suit : suits){
for(int i = 1; i <= 13; i++){
this.card_deck[card_number] = new Card(suit, i);
card_number++;
}
}
}
}
public class Deck{
private Card[] card_deck;
public Deck(){
this.card_deck = new Card[52];
String[] suits = {"Spades", "Hearts", "Diamonds", "Clubs"};
int card_number = 0;
for(String suit : suits){
for(int i = 1; i <= 13; i++){
this.card_deck[card_number] = new Card(suit, i);
card_number++;
}
}
}
@Override
public String toString(){
String output = "";
for(Card a_card : this.card_deck){
output += a_card.toString() + "\n";
}
return output;
}
}
public class Main{
public static void main(String[] args){
Deck a_deck = new Deck();
System.out.println(a_deck.toString());
}
}
public class Main{
public static void main(String[] args){
Deck a_deck = new Deck();
System.out.println(a_deck.toString());
}
}
public class Deck{
private Card[] card_deck;
public Deck(){...}
@Override
public String toString(){...}
}
public class Deck{
private Card[] card_deck;
public Deck(){...}
@Override
public String toString(){...}
public void shuffle(int times){
}
}
public class Deck{
private Card[] card_deck;
public Deck(){...}
@Override
public String toString(){...}
public void shuffle(int times){
for(int i = 0; i < times; i++){
}
}
}
import java.util.Random;
public class Deck{
private Card[] card_deck;
public Deck(){...}
@Override
public String toString(){...}
public void shuffle(int times){
Random rando = new Random();
for(int i = 0; i < times; i++){
int first = rando.nextInt(52);
int second = rando.nextInt(52);
}
}
}
import java.util.Random;
public class Deck{
private Card[] card_deck;
public Deck(){...}
@Override
public String toString(){...}
public void shuffle(int times){
Random rando = new Random();
for(int i = 0; i < times; i++){
int first = rando.nextInt(52);
int second = rando.nextInt(52);
if(first != second){
Card temp = this.card_deck[first];
this.card_deck[first] = this.card_deck[second];
this.card_deck[second] = temp;
}
}
}
}
import java.util.Random;
import java.lang.IllegalArgumentException;
public class Deck{
private Card[] card_deck;
public Deck(){...}
@Override
public String toString(){...}
public void shuffle(int times){
if(times <= 0){
throw new IllegalArgumentException("The deck must ...");
}
Random rando = new Random();
for(int i = 0; i < times; i++){
int first = rando.nextInt(52);
int second = rando.nextInt(52);
if(first != second){
Card temp = this.card_deck[first];
this.card_deck[first] = this.card_deck[second];
this.card_deck[second] = temp;
}
}
}
}
import java.util.Random;
import java.lang.IllegalArgumentException;
public class Deck{
private Card[] card_deck;
public Deck(){...}
@Override
public String toString(){...}
public void shuffle(int times){
if(times <= 0){
throw new IllegalArgumentException("The deck must ...");
}
Random rando = new Random();
for(int i = 0; i < times; i++){
int first = rando.nextInt(52);
int second = rando.nextInt(52);
if(first != second){
Card temp = this.card_deck[first];
this.card_deck[first] = this.card_deck[second];
this.card_deck[second] = temp;
}
}
}
}
public class Main{
public static void main(String[] args){
Deck a_deck = new Deck();
a_deck.shuffle(1000);
System.out.println(a_deck.toString());
}
}
public class Main{
public static void main(String[] args){
Deck a_deck = new Deck();
a_deck.shuffle(1000);
System.out.println(a_deck.toString());
}
}
import java.util.Random;
import java.lang.IllegalArgumentException;
public class Deck{
private Card[] card_deck;
public Deck(){...}
@Override
public String toString(){...}
public void shuffle(int times){...}
}
import java.util.Random;
import java.lang.IllegalArgumentException;
public class Deck{
private Card[] card_deck;
public Deck(){...}
@Override
public String toString(){...}
public void shuffle(int times){...}
public Card draw(){
}
}
import java.util.Random;
import java.lang.IllegalArgumentException;
public class Deck{
private Card[] card_deck;
public Deck(){...}
@Override
public String toString(){...}
public void shuffle(int times){...}
public Card draw(){
Card output = this.card_deck[this.card_position];
this.card_position++;
return output;
}
}
import java.util.Random;
import java.lang.IllegalArgumentException;
public class Deck{
private Card[] card_deck;
private int card_position;
public Deck(){
this.card_position = 0;
...
}
@Override
public String toString(){...}
public void shuffle(int times){...}
public Card draw(){
Card output = this.card_deck[this.card_position];
this.card_position++;
return output;
}
}
import java.util.Random;
import java.lang.IllegalArgumentException;
public class Deck{
private Card[] card_deck;
private int card_position;
public Deck(){
this.card_position = 0;
...
}
@Override
public String toString(){...}
public void shuffle(int times){...}
public Card draw(){
Card output = this.card_deck[this.card_position];
this.card_position++;
return output;
}
}
public class Hand{
}
public class Hand{
private Card[] card_hand;
private int hand_size;
public Hand(){
this.card_hand = new Card[52];
this.hand_size = 0;
}
}
public class Hand{
private Card[] card_hand;
private int hand_size;
public Hand(){
this.card_hand = new Card[52];
this.hand_size = 0;
}
public int getValue(){
int value = 0;
for(int i = 0; i < this.hand_size; i++){
value += this.card_hand[i].getValue();
}
return value;
}
@Override
public String toString(){
String output = "";
for(int i = 0; i < this.hand_size; i++){
output += this.card_hand[i].toString() + "\n";
}
return output;
}
}
public class Hand{
private Card[] card_hand;
private int hand_size;
public Hand(){
this.card_hand = new Card[52];
this.hand_size = 0;
}
public int getValue(){
int value = 0;
for(int i = 0; i < this.hand_size; i++){
value += this.card_hand[i].getValue();
}
return value;
}
@Override
public String toString(){
String output = "";
for(int i = 0; i < this.hand_size; i++){
output += this.card_hand[i].toString() + "\n";
}
return output;
}
public void addCard(Card input){
this.card_hand[this.hand_size] = input;
this.hand_size++;
}
}
public class Dealer{
}
public class Dealer{
private Hand my_hand;
public Dealer(Hand a_hand){
this.my_hand = a_hand;
}
}
public class Dealer{
private Hand my_hand;
public Dealer(Hand a_hand){
this.my_hand = a_hand;
}
@Override
public String toString(){
String output = "The dealer currently holds: \n";
output += this.my_hand.toString();
output += "for a total of " + this.my_hand.getValue();
return output;
}
}
public class Dealer{
private Hand my_hand;
public Dealer(Hand a_hand){ ... }
@Override
public String toString(){ ... }
}
public class Dealer{
private Hand my_hand;
public Dealer(Hand a_hand){ ... }
@Override
public String toString(){ ... }
public void makeMoves(int player_value){
}
}
public class Dealer{
private Hand my_hand;
public Dealer(Hand a_hand){ ... }
@Override
public String toString(){ ... }
public void makeMoves(int player_value){
while(my_hand.getValue() < player_value &&
my_hand.getValue() <= 21){
// we need to draw a card here!
}
}
}
public class Dealer{
private Hand my_hand;
public Dealer(Hand a_hand){ ... }
@Override
public String toString(){ ... }
public void makeMoves(int player_value){
while(my_hand.getValue() < player_value &&
my_hand.getValue() <= 21){
// we need to draw a card here!
}
}
}
Pros:
Cons:
Pros:
Cons:
public class Dealer{
private Hand my_hand;
public Dealer(Hand a_hand){ ... }
@Override
public String toString(){ ... }
public void makeMoves(int player_value){
while(my_hand.getValue() < player_value &&
my_hand.getValue() <= 21){
// we need to draw a card here!
}
}
}
public class Dealer{
private Hand my_hand;
private Deck the_deck;
public Dealer(Hand a_hand, Deck a_deck){
this.my_hand = a_hand;
this.the_deck = a_deck;
}
@Override
public String toString(){ ... }
public void makeMoves(int player_value){
while(my_hand.getValue() < player_value &&
my_hand.getValue() <= 21){
// we need to draw a card here!
}
}
}
public class Dealer{
private Hand my_hand;
private Deck the_deck;
public Dealer(Hand a_hand, Deck a_deck){
this.my_hand = a_hand;
this.the_deck = a_deck;
}
@Override
public String toString(){ ... }
public void makeMoves(int player_value){
while(my_hand.getValue() < player_value &&
my_hand.getValue() <= 21){
Card new_card = this.the_deck.draw();
System.out.println("The dealer draws a " + new_card.toString());
this.my_hand.addCard(new_card);
}
}
}
public class Dealer{
private Hand my_hand;
private Deck the_deck;
public Dealer(Hand a_hand, Deck a_deck){
this.my_hand = a_hand;
this.the_deck = a_deck;
}
@Override
public String toString(){ ... }
public void makeMoves(int player_value){
while(my_hand.getValue() < player_value &&
my_hand.getValue() <= 21){
Card new_card = this.the_deck.draw();
System.out.println("The dealer draws a " + new_card.toString());
this.my_hand.addCard(new_card);
}
}
}
public class Dealer{
private Hand my_hand;
private Deck the_deck;
public Dealer(Hand a_hand, Deck a_deck){
this.my_hand = a_hand;
this.the_deck = a_deck;
}
@Override
public String toString(){
String output = "The dealer currently holds: \n";
output += this.my_hand.toString();
output += "for a total of " + this.my_hand.getValue();
return output;
}
}
public class Dealer{
private Hand my_hand;
private Deck the_deck;
public Dealer(Hand a_hand, Deck a_deck){
this.my_hand = a_hand;
this.the_deck = a_deck;
}
@Override
public String toString(){
String output = "The dealer currently holds: \n";
output += this.my_hand.toString();
output += "for a total of " + this.my_hand.getValue();
return output;
}
}
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){
this.my_hand = a_hand;
this.the_deck = a_deck;
}
@Override
public String toString(){
String output = "The player currently holds: \n";
output += this.my_hand.toString();
output += "for a total of " + this.my_hand.getValue();
return output;
}
}
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){
this.my_hand = a_hand;
this.the_deck = a_deck;
}
@Override
public String toString(){
String output = "The player currently holds: \n";
output += this.my_hand.toString();
output += "for a total of " + this.my_hand.getValue();
return output;
}
}
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){ ... }
@Override
public String toString(){ ... }
}
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){ ... }
@Override
public String toString(){ ... }
public void makeMoves(){
}
}
import java.util.Scanner;
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){ ... }
@Override
public String toString(){ ... }
public void makeMoves(){
try(Scanner reader = new Scanner(System.in)){
}
}
}
import java.util.Scanner;
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){ ... }
@Override
public String toString(){ ... }
public void makeMoves(){
try(Scanner reader = new Scanner(System.in)){
while(my_hand.getValue() <= 21){
}
}
}
}
import java.util.Scanner;
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){ ... }
@Override
public String toString(){ ... }
public void makeMoves(){
try(Scanner reader = new Scanner(System.in)){
while(my_hand.getValue() <= 21){
System.out.println("You currently have a value of " +
this.my_hand.getValue());
System.out.print("Would you like to draw
another card (y/n)?: ");
String input = reader.nextLine().trim();
}
}
}
}
import java.util.Scanner;
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){ ... }
@Override
public String toString(){ ... }
public void makeMoves(){
try(Scanner reader = new Scanner(System.in)){
while(my_hand.getValue() <= 21){
System.out.println("You currently have a value of " +
this.my_hand.getValue());
System.out.print("Would you like to draw
another card (y/n)?: ");
String input = reader.nextLine().trim();
if(input.equals("y") || input.equals("Y")){
Card new_card = this.the_deck.draw();
System.out.println("You draw a " + new_card.toString());
this.my_hand.addCard(new_card);
}else if (input.equals("n") || input.equals("N")){
break;
}else{
System.out.println("Invalid input!");
}
}
}
}
}
import java.util.Scanner;
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){ ... }
@Override
public String toString(){ ... }
public void makeMoves(){
try(Scanner reader = new Scanner(System.in)){
while(my_hand.getValue() <= 21){
System.out.println("You currently have a value of " +
this.my_hand.getValue());
System.out.print("Would you like to draw
another card (y/n)?: ");
String input = reader.nextLine().trim();
if(input.equals("y") || input.equals("Y")){
Card new_card = this.the_deck.draw();
System.out.println("You draw a " + new_card.toString());
this.my_hand.addCard(new_card);
}else if (input.equals("n") || input.equals("N")){
break;
}else{
System.out.println("Invalid input!");
}
}
System.out.println("You end your turn with a value of " +
this.my_hand.getValue());
}
}
}
import java.util.Scanner;
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){ ... }
@Override
public String toString(){ ... }
public void makeMoves(){
try(Scanner reader = new Scanner(System.in)){
while(my_hand.getValue() <= 21){
System.out.println("You currently have a value of " +
this.my_hand.getValue());
System.out.print("Would you like to draw
another card (y/n)?: ");
String input = reader.nextLine().trim();
if(input.equals("y") || input.equals("Y")){
Card new_card = this.the_deck.draw();
System.out.println("You draw a " + new_card.toString());
this.my_hand.addCard(new_card);
}else if (input.equals("n") || input.equals("N")){
break;
}else{
System.out.println("Invalid input!");
}
}
System.out.println("You end your turn with a value of " +
this.my_hand.getValue());
}catch(Exception e){
System.out.println("An exception occurred!\n" + e);
return;
}
}
}
import java.util.Scanner;
public class Player{
private Hand my_hand;
private Deck the_deck;
public Player(Hand a_hand, Deck a_deck){ ... }
@Override
public String toString(){ ... }
public void makeMoves(){
try(Scanner reader = new Scanner(System.in)){
while(my_hand.getValue() <= 21){
System.out.println("You currently have a value of " +
this.my_hand.getValue());
System.out.print("Would you like to draw
another card (y/n)?: ");
String input = reader.nextLine().trim();
if(input.equals("y") || input.equals("Y")){
Card new_card = this.the_deck.draw();
System.out.println("You draw a " + new_card.toString());
this.my_hand.addCard(new_card);
}else if (input.equals("n") || input.equals("N")){
break;
}else{
System.out.println("Invalid input!");
}
}
System.out.println("You end your turn with a value of " +
this.my_hand.getValue());
}catch(Exception e){
System.out.println("An exception occurred!\n" + e);
return;
}
}
}
public class Main{
public static void main(String[] args){
}
}
public class Main{
public static void main(String[] args){
Deck the_deck = new Deck();
}
}
public class Main{
public static void main(String[] args){
Deck the_deck = new Deck();
the_deck.shuffle(1000);
}
}
public class Main{
public static void main(String[] args){
Deck the_deck = new Deck();
the_deck.shuffle(1000);
Hand player_hand = new Hand();
player_hand.addCard(the_deck.draw());
player_hand.addCard(the_deck.draw());
Player a_player = new Player(player_hand, the_deck);
}
}
public class Main{
public static void main(String[] args){
Deck the_deck = new Deck();
the_deck.shuffle(1000);
Hand player_hand = new Hand();
player_hand.addCard(the_deck.draw());
player_hand.addCard(the_deck.draw());
Player a_player = new Player(player_hand, the_deck);
Hand dealer_hand = new Hand();
dealer_hand.addCard(the_deck.draw());
dealer_hand.addCard(the_deck.draw());
Dealer a_dealer = new Dealer(dealer_hand, the_deck);
}
}
public class Main{
public static void main(String[] args){
Deck the_deck = new Deck();
the_deck.shuffle(1000);
Hand player_hand = new Hand();
player_hand.addCard(the_deck.draw());
player_hand.addCard(the_deck.draw());
Player a_player = new Player(player_hand, the_deck);
Hand dealer_hand = new Hand();
dealer_hand.addCard(the_deck.draw());
dealer_hand.addCard(the_deck.draw());
Dealer a_dealer = new Dealer(dealer_hand, the_deck);
a_player.makeMoves();
}
}
public class Main{
public static void main(String[] args){
Deck the_deck = new Deck();
the_deck.shuffle(1000);
Hand player_hand = new Hand();
player_hand.addCard(the_deck.draw());
player_hand.addCard(the_deck.draw());
Player a_player = new Player(player_hand, the_deck);
Hand dealer_hand = new Hand();
dealer_hand.addCard(the_deck.draw());
dealer_hand.addCard(the_deck.draw());
Dealer a_dealer = new Dealer(dealer_hand, the_deck);
a_player.makeMoves();
a_dealer.makeMoves(player_hand.getValue());
}
}
public class Main{
public static void main(String[] args){
Deck the_deck = new Deck();
the_deck.shuffle(1000);
Hand player_hand = new Hand();
player_hand.addCard(the_deck.draw());
player_hand.addCard(the_deck.draw());
Player a_player = new Player(player_hand, the_deck);
Hand dealer_hand = new Hand();
dealer_hand.addCard(the_deck.draw());
dealer_hand.addCard(the_deck.draw());
Dealer a_dealer = new Dealer(dealer_hand, the_deck);
a_player.makeMoves();
a_dealer.makeMoves(player_hand.getValue());
if(player_hand.getValue() <= 21 && dealer_hand.getValue() > 21){
System.out.println("The player wins!");
}else if(player_hand.getValue() <= 21 && player_hand.getValue() > dealer_hand.getValue()){
System.out.println("The player wins!");
}else if(dealer_hand.getValue() <= 21){
System.out.println("The dealer wins!");
}else{
System.out.println("There is no winner");
}
}
}
public class Main{
public static void main(String[] args){
Deck the_deck = new Deck();
the_deck.shuffle(1000);
Hand player_hand = new Hand();
player_hand.addCard(the_deck.draw());
player_hand.addCard(the_deck.draw());
Player a_player = new Player(player_hand, the_deck);
Hand dealer_hand = new Hand();
dealer_hand.addCard(the_deck.draw());
dealer_hand.addCard(the_deck.draw());
Dealer a_dealer = new Dealer(dealer_hand, the_deck);
a_player.makeMoves();
a_dealer.makeMoves(player_hand.getValue());
if(player_hand.getValue() <= 21 && dealer_hand.getValue() > 21){
System.out.println("The player wins!");
}else if(player_hand.getValue() <= 21 && player_hand.getValue() > dealer_hand.getValue()){
System.out.println("The player wins!");
}else if(dealer_hand.getValue() <= 21){
System.out.println("The dealer wins!");
}else{
System.out.println("There is no winner");
}
}
}