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 4 of 4

Thread: making a return for a game

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    24
    My Mood
    Dead
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation making a return for a game

    I have this dilema
    Players simultaneously choose a move: c or d
    If both choose c, they get $3 each
    If both choose d, they get $1 each
    If one chooses c and one chooses d, the d player gets $5 and the c
    player gets nothing

    I need to input it into
    public static int getScore(char firstPlayerMove, char secondPlayerMove )
        {
     
    		return 0;

    this will get the scores when replacing 0.

    is this the right start? and how do I input the rest. Pretty stuck


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

    Default Re: making a return for a game

    It looks like the method is missing a closing curly brace.

    Write down a series of steps you would take if you was going to track the game on paper.
    With these steps you can guide yourself in the code you write.

    The instructions for your assignment make a great outline for the steps to take to solve the problem (play the game).

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    24
    My Mood
    Dead
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: making a return for a game

    I know its missing, its just the part of the code I dont know what to put in it. like How do I get it to score each player with those numbers. As I said, even when writing down I have no clue

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

    Default Re: making a return for a game

    You have to think about how you would solve the problem yourself. You are the "game". Two people pick a letter at the same time. How do you decide how much to pay?
    You have to tell the computer to do the same process one step at a time.
    Where is your list of steps to solve the problem?

Similar Threads

  1. Making a 3D Game?
    By MitchWardle in forum Java Theory & Questions
    Replies: 0
    Last Post: March 25th, 2013, 12:35 PM
  2. Help with making a small game
    By smacker in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 4th, 2013, 03:10 PM
  3. Making a New Game Help
    By AndyLun in forum Java Code Snippets and Tutorials
    Replies: 2
    Last Post: December 5th, 2012, 02:25 AM
  4. Making a Craps game.
    By SOK in forum Object Oriented Programming
    Replies: 1
    Last Post: March 6th, 2010, 07:23 PM
  5. Theory behind 2d Game making?
    By DarrenReeder in forum Java Theory & Questions
    Replies: 3
    Last Post: January 28th, 2010, 01:54 AM