Results 1 to 16 of 16
Thread: Nim game assistance.
- 03-25-2014, 07:17 AM #1
Member
- Join Date
- Mar 2014
- Posts
- 4
- Rep Power
- 0
Nim game assistance.
I figured out how to make it run but it is kind of useless on its own.
__
This is what I have if anybody is interested. I only removed it because it is rather useless.
import java.util.Scanner;
public class nimgame
{
public static void main (String[] args)
{
Scanner keyboard = new Scanner(System.in);
int remaining;
System.out.printf("%d objects which are left:", remaining);
for (int i = 0; i <remaining; i++) {
System.out.print(" * ");
}
System.out.println();
System.out.println("How many do you want to remove?");
remaining -= keyboard.nextInt();
System.out.println("");
System.out.println("Game Over!");
}
}
By making the variable static I can get it to run but not much else.
Thanks.Last edited by juhva; 03-25-2014 at 03:35 PM.
- 03-25-2014, 10:33 AM #2
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: Nim game assistance.
If it is really as addictive as you say it is, you would not be posting a small snippet of code that doesn't even compile. You have to return to your books and learn more.
"Syntactic sugar causes cancer of the semicolon." -- Alan Perlis
- 03-25-2014, 10:58 AM #3
Senior Member
- Join Date
- Feb 2014
- Posts
- 447
- Rep Power
- 8
Re: Nim game assistance.
Hi,
is there any special reason why you choose to write an application in an object oriented language and then restrict yourself with "I wish to use one class only"?
With kind regards,
Konrad
- 03-25-2014, 11:06 AM #4
Member
- Join Date
- Mar 2014
- Posts
- 4
- Rep Power
- 0
Re: Nim game assistance.
One class is needed in this instance.
Last edited by juhva; 03-25-2014 at 01:36 PM.
- 03-25-2014, 11:21 AM #5
Re: Nim game assistance.
You never set "remaining" to 12 to begin with.
"It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013
- 03-25-2014, 03:16 PM #6
Re: Nim game assistance.
So you got your answer but then edited your post to hide the code so other people couldn't get similar help in the future? That's pretty against the whole point of a public forum...
How to Ask Questions the Smart Way
Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
Static Void Games forum - Come say hello!
- 03-25-2014, 03:18 PM #7
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: Nim game assistance.
Meh just wait until Jos wakes up, he'll put it right back.
"Syntactic sugar causes cancer of the semicolon." -- Alan Perlis
- 03-25-2014, 03:28 PM #8
Member
- Join Date
- Mar 2014
- Posts
- 4
- Rep Power
- 0
Re: Nim game assistance.
I got a rather sardonic response from you so I don't know why you'd be giving me a hard time to being with, I was polite and everything and I provided plenty of code to work with.
I was just being polite. I didn't get my answer. I only managed to get it to run but other than that I got absolutely nothing and the code was useless. That, and I felt kind of unwelcome here from the first response which was just hurtful, so I removed my post.
- 03-25-2014, 03:30 PM #9
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: Nim game assistance.
You're wrong, I wasn't impolite and hurtful - only honest. The fact that you chose to believe that and not give me any chance to correct your mistake is just a horrible practice on your part.
"Syntactic sugar causes cancer of the semicolon." -- Alan Perlis
- 03-25-2014, 03:33 PM #10
Re: Nim game assistance.
I thought I contributed something useful... Ah well. I heard RoseIndia.net has awesome Java examples and tutorials you can use!
"It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013
- 03-25-2014, 03:38 PM #11
Member
- Join Date
- Mar 2014
- Posts
- 4
- Rep Power
- 0
- 03-25-2014, 03:43 PM #12
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: Nim game assistance.
So then you go ahead and insult me through your assumptions? Gee thanks.
You DO need to spend more time with your books, questions in the form of "I have all this code, help" don't go anywhere. You either need to ask specific questions, or you need to study more so you can make more progress yourself. Forums are not a substitute tutor, I hope you soon learn that."Syntactic sugar causes cancer of the semicolon." -- Alan Perlis
- 03-25-2014, 05:49 PM #13
Senior Member
- Join Date
- Jan 2013
- Location
- Northern Virginia, United States
- Posts
- 6,226
- Rep Power
- 15
Re: Nim game assistance.
The JavaTM Tutorials | SSCCE | Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
- 03-25-2014, 06:05 PM #14
Re: Nim game assistance.
You missed the sarcasm of that post :) It's a shame the OP said "I didn't get my answer. I only managed to get it to run but other than that I got absolutely nothing", while I contributed to the solution IMHO... He deserves reading RI, and then he'll probably understand why we're not as evil as he thinks. :)
"It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013
- 03-25-2014, 06:12 PM #15
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: Nim game assistance.
You do realize I'll be visiting you later this evening to give you your 10 lashes? Mentioning that site is a sin.
(don't worry, I'll not wear the rubber mask just yet. I know this is your first time)"Syntactic sugar causes cancer of the semicolon." -- Alan Perlis
- 03-25-2014, 06:20 PM #16
Senior Member
- Join Date
- Jan 2013
- Location
- Northern Virginia, United States
- Posts
- 6,226
- Rep Power
- 15
Re: Nim game assistance.
Yep. Didn't get it at all. I guess I'm just slow today.
Regards,
JimThe JavaTM Tutorials | SSCCE | Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
Similar Threads
-
Need some assistance
By adney22 in forum New To JavaReplies: 3Last Post: 06-10-2013, 05:14 PM -
In need of assistance!
By Arete in forum New To JavaReplies: 4Last Post: 01-26-2012, 02:40 AM -
Assistance about this.
By Syfer in forum Advanced JavaReplies: 38Last Post: 06-21-2010, 06:59 PM -
Game assistance.
By Sean_J in forum New To JavaReplies: 2Last Post: 03-16-2010, 05:05 PM
Bookmarks