Results 1 to 12 of 12
Like Tree2Likes
  • 1 Post By joeyvitoro
  • 1 Post By DiamondSoul

Thread: HELP!!!!! SimpleNIM game

  1. #1
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default HELP!!!!! SimpleNIM game

    This is due in a couple hours. I have been struggling with it all week and it just will NOT compile. Here are my two classes. There are more but I am not supposed to touch them, the first draws off the second:
    Last edited by scd250; 10-26-2011 at 06:15 AM.

  2. #2
    DiamondSoul is offline Member
    Join Date
    Oct 2011
    Posts
    83
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    Read what the errors are telling you. "Player cannot be resolved to a type". "SimpleNIM cannot be resolved to a type". For some reason, the classes Player and SimpleNIM are not visible to your program. Did you include them in your project properly?

  3. #3
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    I CANNOT alter the simpleNIM class, it was given and has to be used as-is.

  4. #4
    joeyvitoro is offline Member
    Join Date
    Oct 2011
    Posts
    90
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    He's not suggesting you do. He's saying that the code you wrote can't see the simpleNIM class and the getsticks variable, wherever that may be.

  5. #5
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    OKAY. I included it so it now at least sees the player and simpleNIM classes, but new problem. It still cannot see the sticksLeft variable.

  6. #6
    joeyvitoro is offline Member
    Join Date
    Oct 2011
    Posts
    90
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    OK, so I don't know where that variable is declared. I don't see it in the code you provided. Where so it?

  7. #7
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    aaaaaaaaaa
    Last edited by scd250; 10-26-2011 at 06:16 AM.

  8. #8
    joeyvitoro is offline Member
    Join Date
    Oct 2011
    Posts
    90
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    OK, I see what's happening here. It is an easy fix. Take a look at the getSticksLeft() accessor method. Pay attention to what parameters it takes and what it returns. Now take a look at how you are calling it in your code. See it?
    Fubarable likes this.

  9. #9
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    edited for finish
    Last edited by scd250; 10-30-2011 at 06:58 AM.

  10. #10
    DiamondSoul is offline Member
    Join Date
    Oct 2011
    Posts
    83
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    You don't return anything from that method. You calculate bestMove, but you don't return it. Replace each instance of "bestMove = [some number];" with "return [some number];".
    Fubarable likes this.

  11. #11
    joeyvitoro is offline Member
    Join Date
    Oct 2011
    Posts
    90
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    Don't worry...that's progress. The error is telling you exactly what's wrong. whatever calls the method bestMove is expecting it to return a value. Your code determines what that value should be, but you don't do anything with it.

  12. #12
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Re: HELP!!!!! SimpleNIM game

    It works. Holy $*** it works. Thank you guys so much. Hugs all around! :d

Similar Threads

  1. Replies: 1
    Last Post: 06-02-2011, 10:29 AM
  2. 1st Game
    By linabestprogrammer in forum Java 2D
    Replies: 1
    Last Post: 09-05-2010, 11:32 PM
  3. Replies: 2
    Last Post: 08-05-2010, 05:49 AM
  4. game code for any game
    By deathnote202 in forum Java Gaming
    Replies: 4
    Last Post: 06-10-2010, 09:06 AM
  5. 2D strategy game or 2D war game
    By led1433 in forum Java 2D
    Replies: 5
    Last Post: 02-10-2009, 07:00 AM

Posting Permissions

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