Results 1 to 16 of 16
Like Tree1Likes
  • 1 Post By SurfMan

Thread: Nim game assistance.

  1. #1
    juhva is offline Member
    Join Date
    Mar 2014
    Posts
    4
    Rep Power
    0

    Default 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 02:35 PM.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,098
    Rep Power
    6

    Default 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

  3. #3
    kneitzel is offline Senior Member
    Join Date
    Feb 2014
    Posts
    447
    Rep Power
    1

    Default 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

  4. #4
    juhva is offline Member
    Join Date
    Mar 2014
    Posts
    4
    Rep Power
    0

    Default Re: Nim game assistance.

    One class is needed in this instance.
    Last edited by juhva; 03-25-2014 at 12:36 PM.

  5. #5
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    992
    Rep Power
    2

    Default 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

  6. #6
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,993
    Rep Power
    9

    Default 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 - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,098
    Rep Power
    6

    Default 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

  8. #8
    juhva is offline Member
    Join Date
    Mar 2014
    Posts
    4
    Rep Power
    0

    Default Re: Nim game assistance.

    Quote Originally Posted by gimbal2 View Post
    Meh just wait until Jos wakes up, he'll put it right back.
    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.

    Quote Originally Posted by KevinWorkman View Post
    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...
    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.

  9. #9
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,098
    Rep Power
    6

    Default 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

  10. #10
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    992
    Rep Power
    2

    Default 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!
    juhva likes this.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  11. #11
    juhva is offline Member
    Join Date
    Mar 2014
    Posts
    4
    Rep Power
    0

    Default Re: Nim game assistance.

    Quote Originally Posted by gimbal2 View Post
    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.
    I didn't think you would be willing to help me because you told me to go and read my books.

    Quote Originally Posted by SurfMan View Post
    I thought I contributed something useful... Ah well. I heard RoseIndia.net has awesome Java examples and tutorials you can use!
    I'll definitely have a look. Thank you!

  12. #12
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,098
    Rep Power
    6

    Default 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

  13. #13
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,783
    Rep Power
    5

    Default Re: Nim game assistance.

    Quote Originally Posted by SurfMan View Post
    I thought I contributed something useful... Ah well. I heard RoseIndia.net has awesome Java examples and tutorials you can use!
    Interesting. I haven't heard anything good about that site at all.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  14. #14
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    992
    Rep Power
    2

    Default Re: Nim game assistance.

    Quote Originally Posted by jim829 View Post
    Interesting. I haven't heard anything good about that site at all.

    Regards,
    Jim
    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

  15. #15
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,098
    Rep Power
    6

    Default 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

  16. #16
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,783
    Rep Power
    5

    Default Re: Nim game assistance.

    Yep. Didn't get it at all. I guess I'm just slow today.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Need some assistance
    By adney22 in forum New To Java
    Replies: 3
    Last Post: 06-10-2013, 04:14 PM
  2. In need of assistance!
    By Arete in forum New To Java
    Replies: 4
    Last Post: 01-26-2012, 01:40 AM
  3. Assistance about this.
    By Syfer in forum Advanced Java
    Replies: 38
    Last Post: 06-21-2010, 05:59 PM
  4. Game assistance.
    By Sean_J in forum New To Java
    Replies: 2
    Last Post: 03-16-2010, 04:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •