If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Threaded View

java blackjack program

can somebody help me out, i need to know what topics are included in the program +methods etc..
import java.awt.Graphics;
import java.awt.Image;
import java.util.Random;
import java.awt.*;
import java.awt.event.*;

}while(OK == 0);
Player1pic[i] = getImage(getCodeBase(),card); //mypic does make it to repaint
Player1[i]=y; //new gives dealer his cards
Player1Cards[i]=card;
Player1pic[5]=getImage(getCodeBase(),"back.gif");
if (i<2) //need to record suit of first 2 cards to see if Black Jack occurs
Player1Suit[i]=suit;
}
for (i=0; i<5; i++) //picks 5 unique cards for player2 or the player
{
do
{
card=card_maker(); //calls the next method card_maker
OK=notAlreadyPicked();

tempTotal=tempTotal +tempVal; //player2 is the player, player1 the dealer

}
playerTotal=tempTotal;
}

repaint();
}
if (source==button2) //hit me button
{
int tempTotal=0;
int tempVal=0;
int numAces=0;
if (p<6)
{
//***********correctly scores the cards on each hit
if (p<6) //by using if statement says player can only get a total of 5 cards
{
p=p+1;
}
for (i=0; i<p; i++)
{
if (Player2[i]==1)
{
tempVal=11;
numAces=numAces+1; //counts the number of aces to adjest scores later
}
if (Player2[i]>9)
tempVal=10;
if ((Player2[i]>1) && (Player2[i]<10))
tempVal=Player2[i];
tempTotal=tempTotal +tempVal; //player2 is the player, player1 the dealer
if (tempTotal>21 && numAces>0) //if total is over 21 checks to see if any aces
{
for (int a =0; a<numAces; a++)
{ //loop counts aces as 1 if sum of cards over 21
tempTotal=tempTotal-10; //says if gone over 21 with aces counting 11 each, take 10 off and count then as 1
numAces=numAces-1; //if over and deduct 10, can't do it again so also permanently deduct the ace
if (tempTotal <22) //
break;
}
}

}
playerTotal=tempTotal;
if (tempTotal>21)
{
label7.setText("You Win");
}
if (tempTotal<22) //player gets 21 wins
label7.setText(String.valueOf(playerTotal));
if (p==5 && tempTotal<22) //player gets 5 cards wins...works
{
label7.setText("I Win");
}
if (label7.getText().equals("You Win"))
PlayerCash=PlayerCash + 100;
if (label7.getText().equals("I Win"))
DealerCash=DealerCash + 100;
if (label7.getText().equals("You Win") || label7.getText().equals("I Win") )
{
label7.setText("");
PotCash=0;
reset();
}
label4.setText((String.valueOf(PlayerCash))); //correctly converts an int to a String
label2.setText((String.valueOf(DealerCash)));
label6.setText((String.valueOf(PotCash)));
//**********************end scoringCheckTotal(p);
}
repaint(); //runs the entire paint command again!!!!
}
if (source==button3) //hold button
{
endGame=1;
dealerTotal=Player1[0]+Player1[1];
if (Player1[0]==1 && Player1[1]!=1) //needed to do the while loop in the case the dealer has an ace(s)
dealerTotal=11+Player1[1];
if (Player1[0]!=1 && Player1[1]==1)
dealerTotal=11+Player1[0];
if (Player1[0]==1 && Player1[1]==1)
dealerTotal=11+1;
int tempTotal;
int tempVal;
int numAces;
while(dealerTotal<16)
{
tempTotal=0;
tempVal=0;
numAces=0;
if (d<6)
{
//***********correctly scores the cards on each hit
if (d<6) //by using if statement says player can only get a total of 5 cards
{
d=d+1;
}
for ( i=0; i<d; i++)
{
if (Player1[i]==1)
{
tempVal=11;
numAces=numAces+1; //counts the number of aces to adjest scores later
}
if (Player1[i]>9)
tempVal=10;
if ((Player1[i]>1) && (Player1[i]<10))
tempVal=Player1[i];
tempTotal=tempTotal +tempVal; //player2 is the player, player1 the dealer
if (tempTotal>21 && numAces>0) //if total is over 21 checks to see if any aces
{
for (int a =0; a<numAces; a++)
{ //loop counts aces as 1 if sum of cards over 21
tempTotal=tempTotal-10; //says if gone over 21 with aces counting 11 each, take 10 off and count then as 1
numAces=numAces-1; //if over and deduct 10, can't do it again so also permanently deduct the ace
if (tempTotal <22) //
break;
}
}

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.