DEAL OR NO DEAL HELP THIS IS URGENT PLEASE HELP ME!!!!!

i have a project due in two days and i must create a deal or no deal game in java the following is the code i have currently created i am not very advanced so this is where i am at so far:

// The "DealorNoDeal" class.

import java.awt.*;

import hsa.Console;

import java.util.Random;

publicclass DealorNoDeal

{

static Console c;

publicstaticvoid main (String[] args)

{

c =new Console (30, 110, 15,"DEAL OR NO DEAL");

//setSize(500,500);

double[] CasesValues ={.01, 1, 5, 10, 25, 50, 75, 100, 200, 300, 400, 500, 750, 1000, 5000, 10000, 25000, 50000, 75000, 100000, 200000, 300000, 400000, 500000, 750000, 1000000};

double[] Case =newdouble [26];

int number = 0, Choosen, Remove = 0, Offer = 0;

double PlayerCase;

Random generator =new Random ();

boolean Picked =false;

char Deal =' ';

boolean Not =false;

String name;

// USER ENTERS THEIR NAME

c.println ("Please enter your name: ");

name = c.readString ();

c.println (" ");

// THIS PUTS THE NUMBERS IN THEIR CASES

for (int i = 1 ; i < 26 ; i++)

{

number = generator.nextInt (26);

Case [i] = CasesValues [number];

}

for (int i = 0 ; i < 13 ; i++)

c.println (CasesValues [i] +"\t\t" + CasesValues [i + 13]);

// THE USER CHOOSES THEIR CASE

c.println ("Please Pick Your Case");

Choosen = c.readInt ();

PlayerCase = Case [Choosen];

c.clear ();

// THE USER PICKS 6 CASES TO REMOVE

for (int x = 1 ; x < 7 ; x++)

{

c.print ("Please Choose Case To Remove: ");

Remove = c.readInt ();

for (int i = 1 ; i < 26 ; i++)

{

if (Remove == i)

{

c.clear ();

c.println ("You Picked Case " + Remove +" That had a value of " + Case [i]);

Case [i] = 0;

}

}

c.println ();

c.print ("Case Numbers Picked: ");

for (int i = 1 ; i < 26 ; i++)

{

if (Case [i] == 0)

c.print (" " + i);

}

c.println ();

}

// CALCULATES AND MAKES OFFER

for (int i = 1 ; i < 26 ; i++)

{

Offer += Case [i];

}

Offer = Offer / 19;

c.clear ();

c.println ("The Offer is: " + Offer);

c.println ("DO YOU ACCPET (Y/N)");

Deal = c.readChar ();

if (Deal =='Y' || Deal =='y')

{

c.clear ();

c.println ("CONGRATS, YOU LEAVE WITH " + Offer +"DOLLARS");

}

elseif (Deal =='N' || Deal =='n')

{

c.println ("ALRIGHT NOW YOU MUST OPEN 5 CASES");

}

// THE USER PICKS 5 CASES TO REMOVE

for (int x = 1 ; x < 6 ; x++)

{

c.print ("Please Choose Case To Remove: ");

Remove = c.readInt ();

for (int i = 1 ; i < 26 ; i++)

{

if (Remove == i)

{

c.clear ();

c.println ("You Picked Case " + Remove +" That had a value of " + Case [i]);

Case [i] = 0;

}

}

c.println ();

c.print ("Case Numbers Picked: ");

for (int i = 1 ; i < 26 ; i++)

{

if (Case [i] == 0)

c.print (" " + i);

}

c.println ();

}

// CALCULATES AND MAKES OFFER

for (int i = 1 ; i < 26 ; i++)

{

Offer += Case [i];

}

Offer = Offer / 14;

c.clear ();

c.println ("The Offer is: " + Offer);

c.println ("DO YOU ACCPET (Y/N)");

Deal = c.readChar ();

if (Deal =='Y' || Deal =='y')

{

c.clear ();

c.println ("CONGRATS, YOU LEAVE WITH " + Offer +"DOLLARS");

}

elseif (Deal =='N' || Deal =='n')

{

c.println ("ALRIGHT WE WILL CONTINUE TO OPEN CASES");

}

// THE USER PICKS 4 CASES TO REMOVE

for (int x = 1 ; x < 5 ; x++)

{

c.print ("Please Choose Case To Remove: ");

Remove = c.readInt ();

for (int i = 1 ; i < 26 ; i++)

{

if (Remove == i)

{

c.clear ();

c.println ("You Picked Case " + Remove +" That had a value of " + Case [i]);

Case [i] = 0;

}

}

c.println ();

c.print ("Case Numbers Picked: ");

for (int i = 1 ; i < 26 ; i++)

{

if (Case [i] == 0)

c.print (" " + i);

}

c.println ();

}

// CALCULATES AND MAKES OFFER

for (int i = 1 ; i < 26 ; i++)

{

Offer += Case [i];

}

Offer = Offer / 10;

c.clear ();

c.println ("The Offer is: " + Offer);

c.println ("DO YOU ACCPET (Y/N)");

Deal = c.readChar ();

if (Deal =='Y' || Deal =='y')

{

c.clear ();

c.println ("CONGRATS, YOU LEAVE WITH " + Offer +"DOLLARS");

}

elseif (Deal =='N' || Deal =='n')

{

c.println ("ALRIGHT WE WILL CONTINUE BY OPENING 3 CASES");

}

// THE USER PICKS 3 CASES TO REMOVE

for (int x = 1 ; x < 4 ; x++)

{

c.print ("Please Choose Case To Remove: ");

Remove = c.readInt ();

for (int i = 1 ; i < 26 ; i++)

{

if (Remove == i)

{

c.clear ();

c.println ("You Picked Case " + Remove +" That had a value of " + Case [i]);

Case [i] = 0;

}

}

c.println ();

c.print ("Case Numbers Picked: ");

for (int i = 1 ; i < 26 ; i++)

{

if (Case [i] == 0)

c.print (" " + i);

}

c.println ();

}

// CALCULATES AND MAKES OFFER

for (int i = 1 ; i < 26 ; i++)

{

Offer += Case [i];

}

Offer = Offer / 7;

c.clear ();

c.println ("The Offer is: " + Offer);

c.println ("DO YOU ACCPET (Y/N)");

Deal = c.readChar ();

if (Deal =='Y' || Deal =='y')

{

c.clear ();

c.println ("CONGRATS, YOU LEAVE WITH " + Offer +"DOLLARS");

}

elseif (Deal =='N' || Deal =='n')

{

c.println ("ALRIGHT," + name +"YOU MUST CHOOSE 2 CASES TO OPEN NOW");

}

// THE USER PICKS 2 CASES TO REMOVE

for (int x = 1 ; x < 3 ; x++)

{

c.print ("Please Choose Case To Remove: ");

Remove = c.readInt ();

for (int i = 1 ; i < 26 ; i++)

{

if (Remove == i)

{

c.clear ();

c.println ("You Picked Case " + Remove +" That had a value of " + Case [i]);

Case [i] = 0;

}

}

c.println ();

c.print ("Case Numbers Picked: ");

for (int i = 1 ; i < 26 ; i++)

{

if (Case [i] == 0)

c.print (" " + i);

}

c.println ();

}

// CALCULATES AND MAKES OFFER

for (int i = 1 ; i < 26 ; i++)

{

Offer += Case [i];

}

Offer = Offer / 5;

c.clear ();

c.println ("The Offer is: " + Offer);

c.println ("DO YOU ACCPET (Y/N)");

Deal = c.readChar ();

if (Deal =='Y' || Deal =='y')

{

c.clear ();

c.println ("CONGRATS, YOU LEAVE WITH " + Offer +"DOLLARS");

}

elseif (Deal =='N' || Deal =='n')

{

c.println ("ALRIGHT," + name +"YOU MUST CHOOSE 1 CASE TO OPEN NOW");

}

// THE USER PICKS 1 CASES TO REMOVE

for (int x = 1 ; x < 2 ; x++)

{

c.print ("Please Choose Case To Remove: ");

Remove = c.readInt ();

for (int i = 1 ; i < 26 ; i++)

{

if (Remove == i)

{

c.clear ();

c.println ("You Picked Case " + Remove +" That had a value of " + Case [i]);

Case [i] = 0;

}

}

c.println ();

c.print ("Case Numbers Picked: ");

for (int i = 1 ; i < 26 ; i++)

{

if (Case [i] == 0)

c.print (" " + i);

}

c.println ();

}

// CALCULATES AND MAKES OFFER

for (int i = 1 ; i < 26 ; i++)

{

Offer += Case [i];

}

Offer = Offer / 4;

c.clear ();

c.println ("The Offer is: " + Offer);

c.println ("DO YOU ACCPET (Y/N)");

Deal = c.readChar ();

if (Deal =='Y' || Deal =='y')

{

c.clear ();

c.println ("CONGRATS, YOU LEAVE WITH " + Offer +"DOLLARS");

}

elseif (Deal =='N' || Deal =='n')

{

c.println ("ALRIGHT," + name +"YOU MUST CHOOSE 1 CASE TO OPEN NOW");

// THE USER PICKS 1 CASES TO REMOVE

for (int x = 1 ; x < 2 ; x++)

{

c.print ("Please Choose Case To Remove: ");

Remove = c.readInt ();

for (int i = 1 ; i < 26 ; i++)

{

if (Remove == i)

{

c.clear ();

c.println ("You Picked Case " + Remove +" That had a value of " + Case [i]);

Case [i] = 0;

}

}

c.println ();

c.print ("Case Numbers Picked: ");

for (int i = 1 ; i < 26 ; i++)

{

if (Case [i] == 0)

c.print (" " + i);

}

c.println ();

}

// CALCULATES AND MAKES OFFER

for (int i = 1 ; i < 26 ; i++)

{

Offer += Case [i];

}

Offer = Offer / 3;

c.clear ();

c.println ("The Offer is: " + Offer);

c.println ("DO YOU ACCPET (Y/N)");

Deal = c.readChar ();

if (Deal =='Y' || Deal =='y')

{

c.clear ();

c.println ("CONGRATS, YOU LEAVE WITH " + Offer +"DOLLARS");

}

elseif (Deal =='N' || Deal =='n')

{

c.println ("ALRIGHT," + name +"YOU MUST CHOOSE 1 CASE TO OPEN NOW");

}

// THE USER PICKS 1 CASES TO REMOVE

for (int x = 1 ; x < 2 ; x++)

{

c.print ("Please Choose Case To Remove: ");

Remove = c.readInt ();

for (int i = 1 ; i < 26 ; i++)

{

if (Remove == i)

{

c.clear ();

c.println ("You Picked Case " + Remove +" That had a value of " + Case [i]);

Case [i] = 0;

}

}

c.println ();

c.print ("Case Numbers Picked: ");

for (int i = 1 ; i < 26 ; i++)

{

if (Case [i] == 0)

c.print (" " + i);

}

c.println ();

}

// CALCULATES AND MAKES OFFER

for (int i = 1 ; i < 26 ; i++)

{

Offer += Case [i];

}

Offer = Offer / 2;

c.clear ();

c.println ("The Offer is: " + Offer);

c.println ("DO YOU ACCPET (Y/N)");

Deal = c.readChar ();

if (Deal =='Y' || Deal =='y')

{

c.clear ();

c.println ("CONGRATS, YOU LEAVE WITH " + Offer +"DOLLARS");

}

elseif (Deal =='N' || Deal =='n')

{

c.println ("NOW ITS TIME TO OPEN ONE MORE CASE");

}

// THE USER PICKS 1 CASES TO REMOVE

for (int x = 1 ; x < 2 ; x++)

{

c.print ("Please Choose Case To Remove: ");

Remove = c.readInt ();

for (int i = 1 ; i < 26 ; i++)

{

if (Remove == i)

{

c.clear ();

c.println ("You Picked Case " + Remove +" That had a value of " + Case [i]);

Case [i] = 0;

}

}

c.println ();

c.print ("Case Numbers Picked: ");

for (int i = 1 ; i < 26 ; i++)

{

if (Case [i] == 0)

c.print (" " + i);

}

c.println ();

}

// CALCULATES AND MAKES OFFER

for (int i = 1 ; i < 26 ; i++)

{

Offer += Case [i];

}

Offer = Offer / 2;

c.clear ();

c.println ("The Offer is: " + Offer);

c.println ("DO YOU ACCPET (Y/N)");

Deal = c.readChar ();

if (Deal =='Y' || Deal =='y')

{

c.clear ();

c.println ("CONGRATS, YOU LEAVE WITH " + Offer +"DOLLARS");

}

elseif (Deal =='N' || Deal =='n')

{

c.println ("NOW ITS TIME TO OPEN YOUR CASE, YOUR CASE CONTAINED " + (Offer * 2) +" DOLLARS");

}

}

}

}

i would really appreciate it if you could show me how to tell the player when they have already chose a case and not let them choose it again and if possible have all the values display and eliminate the values as they the cases are opened my e-mail is doctor_j_25@hotmail.com if you can e-mail there or add me on msn it would be really appreciated also for future reference thanks

[24695 byte] By [_hero_a] at [2007-11-26 15:24:30]
# 1

The whole point of public forums is that the whole community can benefit from public discussion - everyone can contribute to anyone's knowledge and learn something along the way. And even when a topic has stopped being discussed, people will still read it and perhaps find the answer to their pressing question.

Answering a question via email or in a private message is quite contrary to this purpose. By suggesting to do so, you might come across more selfishly than you'd like.

Many of the contributors here feel that they could spend their time answering your personal questions, or they could spend their time answering questions on the forum. If they answer in the forum, then others will see my responses, so the same question will not need to be asked twice - and many contributors feel that this is better use of their time.

Additionally, sending you an email might be more work than just answering in the forum - some might even not be able to send email from where they read your post. Those people are also unlikely to answer in the forum, as you indicated that you might not even read it.

cotton.ma at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 2

OK, so you have a really pressing need. The temptation to tell us so, in the hope to get answers faster, is big. So you put an "URGENT" into the subject line, ask for answers "ASAP", reask the question in the same thread or a new one, etc.

Well, here are reasons why this typically isn't a good idea at all:

• We all answer questions here voluntarily, in our leisure time. We do that because doing so is fun for us, because we enjoy helping people and having interesting discussions. Guess what, it is much less fun if it gets stressful. So the last thing you want to do to get us to answer your question is to pass your stress over to us.

• People who are stressed and want a fast answer often don't even find the time to do the necessary research or to formulate their question in an easy to comprehend way. That's even less fun to work with. So you really don't want us to feel your stress. Instead you want to take your time to write a well formulated post that is fun to answer. The less likely it is for us to know that your question is urgent, the more likely you are to get a fast answer!

• The simple notion that you want your post to be answered faster than those of the other members might feel rather unfair to some of us. Doubly so because often "urgent" questions actually are homework questions. Yours might be different, but someone who had bad experiences with this type of question might not read far enough to notice.

• If it is really that urgent, my answer may already come too late, so I will think twice before taking the time to formulate it.

cotton.ma at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 3

Finally your code is just terrible frankly and shows no OO whatsoever.

You have written a procedural program and not a very good one at that

either to be honest.

It needs to be rewritten in it's entirety.

For starters try and think how you can remove the extremely repetitive nature of almost all your program. The code for this should be much, much smaller than you have currently.

cotton.ma at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 4

ok so they ripped you apart.

But ok. They're technically right.

OO = Object Orientation incase you were unaware.

You dont really need Objects to make this work. But it'd be a good idea to have METHOD!!@#!

If you dont know what a method is, you might wanna learn or stop programming right now.

If you know what a method is. Continue.

Here we go:

public class Game

{

double[] CasesValues = {.01, 1, 5, 10, 25, 50, 75, 100, 200, 300, 400, 500, 750, 1000, 5000, 10000, 25000, 50000, 75000, 100000, 200000, 300000, 400000, 500000, 750000, 1000000};

double[] Case = new double [CasesValues.length];

public Game()

{

Random rand = new Random();

// Assign random indeces to Cases

for ( int i = 0; i < Case.length; )

{

int ind = rand.nextInt( Case.length );

if ( Cases[ind] == null )

{

Cases[ind] = CasesValues[i];

i++;

}

}

// guess loop

int number_of_guesses = 6;

for ( int guesses = number_of_guesses; guesses>0; guesses-- )

{

make_guess();

}

}

public void make_guess()

{

//Bla get input

int input = bla bla bla you do this;

if ( Cases[input] != -1 ) //if not -1 then this case is still closed

{

// blablablaaa do whatever with this

Cases[input] = -1;

}

else

{

make_guess(); //if case is open then recall this function to reselect

}

}

Ok no more.

Im not gonna do this all for you. And I have a robot to build. Good luck son.

ArikArikArika at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 5

> ok so they ripped you apart.

> But ok. They're technically right.

> OO = Object Orientation incase you were unaware.

> You dont really need Objects to make this work. But

> it'd be a good idea to have METHOD!!@#!

> If you dont know what a method is, you might wanna

> learn or stop programming right now.

> If you know what a method is. Continue.

> ...

> if ( Cases[ind] == null )

Primitives are never null.

I'v said this before, but I think you really really really should take a look at Java's code conventions:

http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

prometheuzza at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 6
> I'v said this before, but I think you really> really really should take a look> at Java's code conventions:But I thought code should be unindented and have useless comments.
CaptainMorgan08a at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 7
and ambiguous variable names, with liberal use of upper case at the start (but only on some, lets not be consistent), and underscores (you can never have enough underscores, in_fact_ _her_e are _a few_.)
macrules2a at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 8

> and ambiguous variable names, with liberal use of

> upper case at the start (but only on some, lets not

> be consistent), and underscores (you can never have

> enough underscores, in_fact_ _her_e are _a few_.)

If my brother in law, who suffers from ADHD, was a programmer, I would imagine he'd code the way Ark does.

@ArikArikArik:

Frank, is that you?

prometheuzza at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 9

> > and ambiguous variable names, with liberal use of

> > upper case at the start (but only on some, lets

> not

> > be consistent), and underscores (you can never

> have

> > enough underscores, in_fact_ _her_e are _a

> few_.)

>

> If my brother in law, who suffers from ADHD, was a

> programmer, I would imagine he'd code the way Ark

> does.

>

> @ArikArikArik:

> Frank, is that you?

:D lol...

macrules2a at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 10

Why is everybody on this thread so violent.

All I did was give my advice to the guy and now IM getting torn to pieces by prometheuzzzzzzz and marcrules.

Look:

1) I taught myself Java and I didn't learn the conventions properly (at all).

2) I can't indent code directly in the java forum message editor.

3) When I write my posts I often dont test them because they're pseudo-code so they dont need to be made in Eclipse or JCreator or w/e.

4) Stop being so violent towards people when they're asking for help

Does that explain why i code as i do?

ArikArikArika at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 11

> 1) I taught myself Java and I didn't learn the

> conventions properly (at all).

So did I, except I taught myself proper conventions.

> 2) I can't indent code directly in the java forum

> message editor.

I do it all the time.

> 3) When I write my posts I often dont test them

> because they're pseudo-code so they dont need to be

> made in Eclipse or JCreator or w/e.

Why don't you mention that? It doesn't look like pseudo-code at all, either.

> 4) Stop being so violent towards people when they're

> asking for help

We aren't. We refuse to help people who refuse to do their share of the work. If someone comes here with a general problem, or with an assignment, and shows that they have put no work in themselves, then they will not be helped. It's cheating.

CaptainMorgan08a at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...
# 12

> Why is everybody on this thread so violent.

Nobody was violent.

Just to address my first posts.

1) The subject line is very annoying

2) Asking for people to email you is not on

3) The code is ****. It's unbearable lengthy and the more I looked at it the more I cringed. As you yourself noted in your reply more methods would be a good start. Even if _hero_ were to get the program in it's current form to work then as a grade it gets no better than a D and possibly an F anyway.

So while I think encouragement is fine and noble there are sometimes you have to call a spade a spade. The OP (_hero_) if he wants help here needs to be prepared to interact on the forum in a communally acceptable fashion (see 1 and 2) and to start from scratch with his code (see 3). While this may not be what the OP wanted to hear playing pollyanna about it is counter-productive.

> All I did was give my advice to the guy and now IM

> getting torn to pieces by prometheuzzzzzzz and

> marcrules.

> Look:

> 1) I taught myself Java and I didn't learn the

> conventions properly (at all).

> 2) I can't indent code directly in the java forum

> message editor.

> 3) When I write my posts I often dont test them

> because they're pseudo-code so they dont need to be

> made in Eclipse or JCreator or w/e.

There is a lot of whining going on here. Just take the advice given for what it is worth. Learn conventions. Start indenting. Stop using an IDE (for now).

Above all stop taking it so personally. If you post code that is **** on this site more often then not someone will point it out. Subtly or un-subtly as the case may be.

> 4) Stop being so violent towards people when they're

> asking for help

Again see my previous points. Nobody was violent to anyone. Further the OP needs a wakeup call.

>

> Does that explain why i code as i do?

Not really.

cotton.ma at 2007-7-8 21:39:59 > top of Java-index,Other Topics,Java Game Development...