Twitist Forums
Pls comment on my Java game? - Printable Version

+- Twitist Forums (http://twitist.com)
+-- Forum: Facebook forums (/forum-14.html)
+--- Forum: General facebook and life forums (/forum-25.html)
+--- Thread: Pls comment on my Java game? (/thread-80946.html)



Pls comment on my Java game? - Angus - 08-23-2013 01:09 PM

Hi, I'm 16 and have only been programing for just half a year. I made this black jack game, do you think its good, do you like it, give me your opinion.

import javax.swing.*;
public class blackjack
{
public static void main (String [] args)
{

// balances

int pl=0; //
int pc=0;
int bal=0;
int pcbal=1000;
int bet=50;
int dif=0;
int hit=0;
int a;

///////////////////


JOptionPane.showMessageDialog(null,"Ru… \n Its you vs the computer, Make sure you get closer to 21 that him, but be careful not to go over 21 \n You can choose your balance, but make sure it doesn't run out, or game over \n the betting will start at R100 but will increase by R50 each round. \n Have fun!!!");

bal=Integer.parseInt(JOptionPane.showI… will be your starting balance (1000 for medium players)?"));

dif=Integer.parseInt(JOptionPane.showI… difficulty would you like to play on? \n Easy-3 \n Hard-2 \n Expert-1"));
dif=dif+2;

while(bal>0 && pcbal>0)
{
bet=bet+50;
JOptionPane.showMessageDialog(null,"O… the betting for this round is R" +bet+ "\n Your current balance is R" +bal+ "\n Your opponent's balance is R" +pcbal+ "\n Good luck.");

pc=20-(int) (Math.random()* (dif));
JOptionPane.showMessageDialog(null,"P… scored " +pc+ " \n Its up to you, Good Luck!!!");


while (hit<2)
{
pl=(pl+(int)(Math.random()* 10));
hit=Integer.parseInt(JOptionPane.sho… score is: " +pl+"\n Would you like to: \n 1: Hit \n 2: Stay"));
}

if (pl>22)
{
JOptionPane.showMessageDialog(null,"S… you went over 21 \n You lose R" +bet+ " \n Try again.");
bal=bal-bet;
pcbal=pcbal+bet;
}

else
if (pl>pc)
{
JOptionPane.showMessageDialog(null,"C… \n You win R" +bet);
bal=bal+bet;
pcbal=pcbal-bet;
}

else
{
JOptionPane.showMessageDialog(null,"S… pc got a better score. \n You Lose R" +bet);
bal=bal-bet;
pcbal=pcbal+bet;
}

pl=pl*0;
hit=hit*0;

}

if (pl>0)
{
JOptionPane.showMessageDialog(null,"Yo… Win");
}

else
{
JOptionPane.showMessageDialog(null,"Ga… Over");
}


}}


An opinion would be great, thanks.


- Daniel - 08-23-2013 01:14 PM

i Cant See the Game i Would Have to See the Game In Action in order To Tell you If its Good Or Not