Here is the rubric for our final project that I\'m needing help with: Rubric for
ID: 3556272 • Letter: H
Question
Here is the rubric for our final project that I'm needing help with:
Rubric for Final Project:
=========================
Vanilla BlackJack: 20 pts.
good coding practices (formatting, indentation, naming conventions)
with one or more shoes, one deck shuffled at start of each shoe
one player, tracking chips bought, amount won/lost, bj payoff of 1.5x
dealer stays on soft 17 or above, does not check BJ before play,
Dealer behavior (5 possible pts.):
More than one deck of cards: 1 pt.
Parameterization (i.e. allow flag to be set at beginning of the game or in a constant) on shoe-ending criteria: 1 pt.
Parameterization on blackjack payoff amount: 1 pt.
Parameterization on whether dealer hits on "soft" (i.e., those where Ace is counted as 11) values over 17: 1 pt.
Parameterization to make dealer play with a hole card that is checked for BJ before players continue playing: 1 pt.
Wagers (2 possible pts.):
Enforce minimum and maximum wagers: 1 pt.
Enforce wagers being a multiple of smallest chip times 2: 1 pt.
Doubling down (3 possible pts.):
Allow doubling on any hand: 2 pts.
Parameterization for alternate doubling rules (only 10-11, only 9-11, any): 1 pt.
Splitting pairs (8 possible pts.):
Allow splitting: 5 pts.
Parameterization for maximum number of splits: 1 pt.
Parameterization for not splitting aces: 1 pt.
Parameterization for only allowing one card on split aces and BJs only counting as a regular 21: 1 pt.
Insurance: 2 pts.
Surrender: 2 pts.
Multiple players (8 possible pts.):
Up to seven players: 5 pts.
Side bets by other players: 2 pts.
Allow player to enter the game mid-shoe: 1 pt.
Graphical user-interface: 10 pts.
Strategy (15 possible points):
Advise player on hit, double, split, insurance decisions according to a standard play book: 5 pts.
Advise player based on current probabilities based on the cards observed so far: 5 pts.
Simulate play based on above advice and record results: 5 pts.
Total possible points (out of 30): 75
I'm not wanting everything, but at least a little more than the minimum would be appreciated.
Here is the CardDeck class that we were given to use as a guide:
import java.util.Random;
/*
** CardDeck class: used for handling a large multiple-deck set of cards for Blackjack or other similar games.
*/
public class CardDeck
{
public static final int CARDS_PER_DECK = 52; // number of cards in a standard French deck
public static final int NUM_SUITS = 4; // number of suits in a standard French deck
public static final int ACE = 1; // card value representing an Ace
public static final int KING = 13; // card value representing a King
public static final int QUEEN = 12; // card value representing a Queen
public static final int JACK = 11; // card value representing a Jack
public static final int NO_MORE_CARDS = 0; // card value representing the end of deck (such as returned by nextCard for an empty deck)
// Private fields
private int current; // current top of the deck; next card to be returned by nextCard() is at cards[current-1]
private int cards[]; // array of all the cards
private Random rand; // random number generator used by randomCard()
/*
** ctor: constructs a stack of cards with 52 * numDecks cards in it and sets it to start dealing at the top
*/
public CardDeck( int numDecks )
{
rand = new Random();
cards = new int[numDecks * CARDS_PER_DECK];
current = 0;
for( int deck = 0; deck < numDecks; deck++ )
for( int suit = 0; suit < NUM_SUITS; suit++ )
for( int val = ACE; val <= KING; val++ )
cards[current++] = val;
}
/*
** nextCard(): deal the next card from the draw pile and place it in the discard pile; returns that card, or NO_MORE_CARDS if there are no cards in the draw pile
*/
public int nextCard()
{
if( current < 0 )
return NO_MORE_CARDS;
current--;
return cards[current];
}
/*
** shuffle(): make a random permutation of the current deck of cards
*/
public void shuffle()
{
// return all the discards back to the draw pile
current = cards.length;
// pull out a card at random and place in discards until there are no more cards left in draw pile
for( int i = 0; i < cards.length; i++ )
randomCard();
// return all the (random) discards back into the draw pile
current = cards.length;
}
/*
** getNumCards(): number of cards left in the draw pile
*/
public int getNumCards()
{
return current;
}
/*
** getTotalCards(): number of cards in total, i.e., the number in the discard pile plus the number in the draw pile
*/
public int getTotalCards()
{
return cards.length;
}
/*
** getProportionLeft(): proportion of total deck remaining in the draw pile
*/
public double getProportionLeft()
{
return (double) getNumCards() / getTotalCards();
}
/*
** static cardName1(card): return a 1-character string representation for the given card
*/
public static String cardName1( int card )
{
switch( card )
{
case ACE: return "A";
case 2: return "2";
case 3: return "3";
case 4: return "4";
case 5: return "5";
case 6: return "6";
case 7: return "7";
case 8: return "8";
case 9: return "9";
case 10: return "T";
case JACK: return "J";
case QUEEN: return "Q";
case KING: return "K";
case NO_MORE_CARDS: return "end of deck marker";
default: return "?";
}
}
/*
** displayDeck(): print out to console the entire contents of the deck (discard pile followed by the draw pile)
*/
public void displayDeck()
{
for( int i = cards.length - 1; i >= 0; i-- )
{
if( i == current - 1 )
System.out.print( "^" );
System.out.print( cardName1( cards[i] ));
if( i % 52 == 0 )
System.out.println();
}
}
/*
** randomCard(): like nextCard() except the card will be drawn at random from anywhere in the draw pile
*/
public int randomCard()
{
int pick;
int pickedVal;
// pick a location and it's corresponding card at random from draw pile
pick = rand.nextInt( getNumCards() );
pickedVal = cards[pick];
// move it to the discard pile by moving intervening draw pile cards down one slot
current--;
for( int i = pick; i < current; i++ )
cards[i] = cards[i+1];
cards[current] = pickedVal;
// return the randomly picked card (now at bottom of discard pile)
return pickedVal;
}
}
Thank you in advance for your assistance.