Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: How to make craps game?

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to make craps game?

    never mind


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,324
    Thanks
    56
    Thanked 2,374 Times in 2,345 Posts

    Default Re: How to make craps game?

    guide me in the right direction
    Can you describe what you want the program to do?
    What problems are you having making the program do it?


    The posted code needs formatting. Nested statements should be indented 3-4 spaces to make it readable.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2013
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to make craps game?

    Quote Originally Posted by Norm View Post
    Can you describe what you want the program to do?
    What problems are you having making the program do it?


    The posted code needs formatting. Nested statements should be indented 3-4 spaces to make it readable.
    I need to create an output of this nature

    javac Craps.java
    java Craps

    "Pass" line (1) or the "Don't Pass" line (2): 1
    Bet: 1
    Dice 1: 4 and dice 2: 1. Sum: 5
    The button is On. Point: 5.
    Dice 1: 5 and dice 2: 5. Sum: 10
    Dice different than 7 and 5. Repeat!
    Dice 1: 5 and dice 2: 1. Sum: 6
    Dice different than 7 and 5. Repeat!
    Dice 1: 5 and dice 2: 6. Sum: 11
    Dice different than 7 and 5. Repeat!
    Dice 1: 6 and dice 2: 5. Sum: 11
    Dice different than 7 and 5. Repeat!
    Dice 1: 5 and dice 2: 5. Sum: 10
    Dice different than 7 and 5. Repeat!
    Dice 1: 5 and dice 2: 5. Sum: 10
    Dice different than 7 and 5. Repeat!
    Dice 1: 1 and dice 2: 3. Sum: 4
    Dice different than 7 and 5. Repeat!
    Dice 1: 5 and dice 2: 4. Sum: 9
    Dice different than 7 and 5. Repeat!
    Dice 1: 5 and dice 2: 3. Sum: 8
    Dice different than 7 and 5. Repeat!
    Dice 1: 5 and dice 2: 2. Sum: 7
    You lost. Score: 49.

    "Pass" line (1) or the "Don't Pass" line (2): 2
    Bet: 2
    Dice 1: 2 and dice 2: 3. Sum: 5
    The button is On. Point: 5.
    Dice 1: 1 and dice 2: 4. Sum: 5
    You won. Score: 51.

    "Pass" line (1) or the "Don't Pass" line (2):
    ...

    --- Update ---

    These are basically the instructions
    "
    Implement a simplified craps game with betting between 1 user (the shooter) and the computer (the bank) for 10 rounds. Players can bet on the various options by placing chips in the appropriate sections of the board. The shooter starts with 50 $1 chips and has two dice.

    The user (i.e., the shooter) must place a bet of maximum 5 chips on the "Pass" line or the "Don't Pass" line. The game is played in rounds and these "Pass" and "Don't Pass" bets are betting on the outcome of a round. Each round has two phases: "come-out" and "point". To start a round, the shooter makes one "come-out" rolls. A come-out roll of 2, 3 or 12 is called "craps" or "crapping out", and the user betting the Pass line loses. A come-out roll of 7 or 11 is a "natural", and the Pass line wins (even wins: 1:1). The other possible numbers are the point numbers: 4, 5, 6, 8, 9, and 10. If the shooter rolls one of these numbers on the come-out roll, this establishes the "point" - to "pass" or "win", the point number must be rolled again before a seven. The dealer flips a button to the "On" side and moves it to the point number signifying the second phase of the round. If the shooter "hits" the point value again (any value of the dice that sum to the point will do; the shooter doesn't have to exactly repeat the value combination of the come-out roll) before rolling a seven, the Pass line wins (1:1) and a new round starts. If the shooter rolls any seven before repeating the point number (a "seven-out"), the Pass line loses and the round is over. In all the above scenarios, whenever the Pass line wins, the Don't Pass line loses, and vice versa, with one exception: on the come-out roll, a roll of 12 will cause Pass Line bets to lose, but Don't Pass bets are pushed (or "barred"), neither winning nor losing.

    Betting example: Lets say that you have $50 and you bet $5.
    If you win, you will get your $5 bet back plus another $5. Your purse will be $55.
    If you loose, you will loose your $5 bet. Your purse will be $45. "

  4. #4
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,550
    My Mood
    Grumpy
    Thanks
    0
    Thanked 169 Times in 160 Posts

    Default Re: How to make craps game?

    Most people understand how craps works. That is not what Norm was asking. Your first post was basically "here's my code, fix it for me". That is not how it works. What you need to do is ask a specific question, then we can provide a specific answer.
    Improving the world one idiot at a time!

  5. #5
    Junior Member
    Join Date
    Apr 2013
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to make craps game?

    Quote Originally Posted by Junky View Post
    Most people understand how craps works. That is not what Norm was asking. Your first post was basically "here's my code, fix it for me". That is not how it works. What you need to do is ask a specific question, then we can provide a specific answer.
    I just want know how to go about implementing crap. I' m basically wondering what kind of methods I should use, etc.

  6. #6
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,550
    My Mood
    Grumpy
    Thanks
    0
    Thanked 169 Times in 160 Posts

    Default Re: How to make craps game?

    That is not a specific question. An example of what I mean is if someone was having trouble with a loop not executing the correct number of times then they could post their code and ask "Why is my loop executing 5 times when it should only execute 4 times?" Something like that.

    You are basically saying "I don't know how to do my assignment" which is very broad to which I respond you need to go back to basics and read your lecture notes and/or text book.
    Improving the world one idiot at a time!

  7. #7
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: How to make craps game?

    Quote Originally Posted by cbplayer View Post
    I' m basically wondering what kind of methods I should use, etc.
    Ones which as a team implement the game.
    One method might generate a roll, returning two values.
    One method might raise a bet amount
    One method might lower a bet amount
    The idea is not to try to make a list of methods to write, but to write down a series of steps that will solve the problem. Your problem is to play a game. So first you have to decide what you need to play the game, these will be the objects involved. The methods you end up with will be what ever becomes necessary to interact with these objects while you play a game. Dice must be rolled. Bets must be added, subtracted etc.
    Write down the steps necessary to play a game and try to organize them into classes.

Similar Threads

  1. Replies: 3
    Last Post: March 1st, 2013, 11:01 PM
  2. [Homework]Game of craps help
    By mullinz in forum Java Theory & Questions
    Replies: 1
    Last Post: November 6th, 2011, 10:48 PM
  3. Making a Craps game.
    By SOK in forum Object Oriented Programming
    Replies: 1
    Last Post: March 6th, 2010, 08:23 PM
  4. Game of Craps: won't compile
    By FreeBird in forum What's Wrong With My Code?
    Replies: 9
    Last Post: February 15th, 2010, 05:12 PM
  5. Craps- GAME fine tunning.
    By Beaney in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 3rd, 2010, 08:32 PM