Page 1 of 2 12 LastLast
Results 1 to 20 of 21
Like Tree1Likes

Thread: High-Low Game

  1. #1
    TANKDS is offline Member
    Join Date
    Feb 2012
    Posts
    54
    Rep Power
    0

    Default High-Low Game

    I am trying to create a game hopefully with a graphics interface. The game will be like the high-low card game with a graphics interface where a card is shown and the user has to select either higher or lower, and if they are wrong the game ends and gives the options to either exit or start a new game.

    What I aim to do:

    \\Create a graphics interface
    \\Create basic code
    \\Create user-input prior to graphics interface

    I want to start off by creating a simple program that I can run in command prompt and I will be able to input either high or low and other basic functionality's will also work. What I am trying to find out is how I can either give the user options to choose or ask the user a question and when an answer is in-putted it responds appropriately doing what is asked or by asking for another input. Could anyone help enlighten me with how I can allow a user input?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,658
    Blog Entries
    7
    Rep Power
    21

    Default Re: High-Low Game

    Have you read about the Scanner class?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    TANKDS is offline Member
    Join Date
    Feb 2012
    Posts
    54
    Rep Power
    0

    Default Re: High-Low Game

    Quote Originally Posted by JosAH View Post
    Have you read about the Scanner class?

    kind regards,

    Jos
    No, I will have a look at this when I get chance, thanks. :)

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,658
    Blog Entries
    7
    Rep Power
    21

    Default Re: High-Low Game

    Quote Originally Posted by TANKDS View Post
    No, I will have a look at this when I get chance, thanks. :)
    You should read Sun's/Oracle's tutorials more (and the API documentation); I bet the tutorials at least mention the Scanner class.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    TANKDS is offline Member
    Join Date
    Feb 2012
    Posts
    54
    Rep Power
    0

    Default Re: High-Low Game

    I have had a look at the Scanner class but I am not fully understand in what way I am suppose to use it, I am relatively new to java and the large amount of code that they use in the really big index to give examples with I am not able to fully understand and learn to use in creating what I am trying to make.

  6. #6
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: High-Low Game

    From the Really Big Index: Scanning (The Java™ Tutorials > Essential Classes > Basic I/O)

    If you consider this a "large amount of code", then I'm sorry... programming is not for you.
    Get in the habit of using standard Java naming conventions!

  7. #7
    TANKDS is offline Member
    Join Date
    Feb 2012
    Posts
    54
    Rep Power
    0

    Default Re: High-Low Game

    You forget I am a beginner and that amount of code easily confuses as I am not used to having so many unknowns shown to me at once.

  8. #8
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: High-Low Game

    Then start with the "Hello World" example and work through each example in order so there is only one new concept at a time.
    Get in the habit of using standard Java naming conventions!

  9. #9
    TANKDS is offline Member
    Join Date
    Feb 2012
    Posts
    54
    Rep Power
    0

    Default Re: High-Low Game

    Quote Originally Posted by kjkrum View Post
    Then start with the "Hello World" example and work through each example in order so there is only one new concept at a time.
    This is what I am doing, I didn't come to these forums to be told all the time I should learn really big index, I came here to get help with the things that I am currently working on.

  10. #10
    awinston is offline Student
    Join Date
    Jul 2012
    Location
    United States
    Posts
    328
    Rep Power
    3

    Default Re: High-Low Game

    Quote Originally Posted by TANKDS View Post
    This is what I am doing, I didn't come to these forums to be told all the time I should learn really big index, I came here to get help with the things that I am currently working on.
    But when you need help with the basics, it's only logical that we point you to the Java Tutorials. There's no point in somebody wasting his own time creating a tutorial specifically for your issue when a general tutorial that has already been made will do just as well.
    "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill

  11. #11
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: High-Low Game

    You've asked two kinds of questions here: very simple beginner questions that you don't even understand the answer to when people like Norm try to talk you through it; and very advanced, broad, and vague questions like this one. If you refuse to take things step by step between whatever you do understand and the things you're asking about, then basically you're just asking people to write your program for you. And nobody wants to do that.
    awinston likes this.
    Get in the habit of using standard Java naming conventions!

  12. #12
    TANKDS is offline Member
    Join Date
    Feb 2012
    Posts
    54
    Rep Power
    0

    Default Re: High-Low Game

    If I am to learn the scanner class is it absolutely necessary for me to learn every page prior to it in the RBI?

  13. #13
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,658
    Blog Entries
    7
    Rep Power
    21

    Default Re: High-Low Game

    Quote Originally Posted by TANKDS View Post
    If I am to learn the scanner class is it absolutely necessary for me to learn every page prior to it in the RBI?
    Not really, because the RBI mentions all tutorials (that's why it's really big). There is a paragraph about basic IO where the Scanner class is mentioned; that'd be a good starting point. If that paragraph mentions stuff you have never heard about or you don't understand, look in the RBI again.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  14. #14
    TANKDS is offline Member
    Join Date
    Feb 2012
    Posts
    54
    Rep Power
    0

    Default Re: High-Low Game

    Thanks, I will take a look at that when I get chance.

  15. #15
    TANKDS is offline Member
    Join Date
    Feb 2012
    Posts
    54
    Rep Power
    0

    Default Re: High-Low Game

    I have been looking over the scanner class repeatedly and I am seeing a way for it to print an output of a file with a specified separator but I am not understanding how to use it to help with user input. Am I missing something really obvious?

  16. #16
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default Re: High-Low Game

    Yeah,

    Java Code:
    //...
    Scanner userInput = new Scanner(System.in);
    int num = userInput.nextInt();
    //...

  17. #17
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default Re: High-Low Game

    The Scanner class doesn't have the ability to print anything. Are you trolling us?
    Get in the habit of using standard Java naming conventions!

  18. #18
    TANKDS is offline Member
    Join Date
    Feb 2012
    Posts
    54
    Rep Power
    0

    Default Re: High-Low Game

    Quote Originally Posted by kjkrum View Post
    The Scanner class doesn't have the ability to print anything. Are you trolling us?
    In the tutorial is talks about printing words on new lines and stuff like that?

  19. #19
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,096
    Rep Power
    20

    Default Re: High-Low Game

    That's what the program does that is using Scanner.
    The Scanner doesn't print the words on different lines, it simply reads each token (word) from the file.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  20. #20
    TANKDS is offline Member
    Join Date
    Feb 2012
    Posts
    54
    Rep Power
    0

    Default Re: High-Low Game

    Quote Originally Posted by Tolls View Post
    That's what the program does that is using Scanner.
    The Scanner doesn't print the words on different lines, it simply reads each token (word) from the file.
    Oh, sorry to confuse you lol

Page 1 of 2 12 LastLast

Similar Threads

  1. High and Low Game using limited resource
    By xcaldk74 in forum New To Java
    Replies: 12
    Last Post: 02-29-2012, 08:38 PM
  2. problem with high low game
    By zlass in forum New To Java
    Replies: 2
    Last Post: 12-03-2011, 08:51 PM
  3. High Quality .....
    By farzana shamim in forum Forum Lobby
    Replies: 1
    Last Post: 07-22-2009, 02:43 PM
  4. sample of guess high and low game
    By pouria62 in forum AWT / Swing
    Replies: 1
    Last Post: 10-26-2008, 12:57 PM
  5. High BW sites
    By Sarinam in forum Networking
    Replies: 2
    Last Post: 06-16-2008, 02:38 PM

Tags for this Thread

Posting Permissions

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