Skip to content

Hints for Group A

1. Task
1

(1) Add the following line of code to

blackjack.surrender(localplayer);

to

private void
surrenderButtonActionPerformed(java.awt.event.ActionEvent evt) in Canvas.java

 

(2) add the following line of code to
the end of Game.java

public void surrender(Player
currentPlayer) {

jackCanvas.disablePlayerButtons();

drawDealerCards();

currentPlayer.updateBalance(currentPlayer.getBet()/2);

jackCanvas.updatePlayerBalance(currentPlayer.getBalance());

}

 

 

2. Task
2

 

(1) Remove the following lines of code from dealCards() in
Game.java

if(players.get(j).isBust())

{

players.get(j).resetBust();

}

And also remove the following line from
dealCards() in Game.java

jackDealer.resetBust();

 

(2) Remove the following lines of code from Player.java

public void resetBust() {

bust = false;

}

(3) Insert the following
lines of code to getTotal() in Player.java

else{

bust = false;

}

Right after the following
lines of code in getTotal()

if(cardSum > 21) {      // Checks to see if busted!!

bust = true;

}

3. Task
3

(1) Add the following
lines of code to Shoe.java

private boolean isShuffleBetweenDesks;

 

(2) Replace the following line of code in Shoe() in
Shoe.java

resetShoe();

 

with the following lines of code

isShuffleBetweenDesks = true;

resetShoe(isShuffleBetweenDesks);

 

(3) Replace the following line of code in getCard() in
Shoe.java

resetShoe();

 

with the following lines of code

resetShoe(isShuffleBetweenDesks);

 

(4) Replace the following lines of code in Shoe.java

public void resetShoe() {

for(int i = num_decks; i >= 0; i–)

{

Deck newDeck = new Deck();

newDeck.shuffleDeck();

Card[] cards = newDeck.getDeck();

for (int j = 51; j >= 0; j–) {

shoe.push(cards[j]);

}

}

}

with the following lines of code

public void resetShoe(boolean isShuffleBetweenDesks)
{

if (isShuffleBetweenDesks){

Stack<Card> shoe1 =
new Stack();

Stack<Card> shoe2 =
new Stack();

for(int i = num_decks; i
>= 0; i–)

{

Deck newDeck = new Deck();

newDeck.shuffleDeck();

Card[] cards =
newDeck.getDeck();

for (int j = 51; j >= 26;
j–) {

shoe1.push(cards[j]);

}

for (int j = 25; j >= 0;
j–) {

shoe2.push(cards[j]);

}

}

while (shoe1.size() > 0){

shoe.push(shoe1.pop());

}

while (shoe2.size() > 0){

shoe.push(shoe2.pop());

}

}

else{

for(int i = num_decks; i
>= 0; i–)

{

Deck newDeck = new Deck();

newDeck.shuffleDeck();

Card[] cards =
newDeck.getDeck();

for (int j = 51; j >= 0;
j–) {

shoe.push(cards[j]);

}

}

}

}

4. Task
4

(1) Replace the
hasBlackJack() fuction in Game.java with the following lines of code

public void hasBlackJack() {

if(jackDealer.getTotal() == 21)

{

jackCanvas.disablePlayerButtons();

drawDealerCards();

if (players.get(thisplayer).getTotal()
== 21){ //PUSH

players.get(0).updateBalance(players.get(thisplayer).getBet());

}

}

if(players.get(thisplayer).getTotal()
== 21) //jackDealer.getTotal() != 21

{

jackCanvas.disablePlayerButtons();

drawDealerCards();

int bet =
players.get(thisplayer).getBet();

bet = (int) ((int) bet + (bet *
1.5));

players.get(thisplayer).updateBalance(bet);

jackCanvas.updatePlayerBalance(players.get(thisplayer).getBalance());

}

}

 

(2) Replace the following line of code in dealerPlay () in Game.java

if(total < 17) {

with the following lines of code

if((total < 17)  ||

((total == 17) &&
jackDealer.isSoft())) {