PROBLEM:
'Modify the game to allowe the user to specify the difficulty of the
game as command line parameters:
java HiLo nDicenSides
EG java HiLo 2 6 would roll two six sided dice and add the results to
give a number between one and twelve..
after each game ask the user if they wish to play again.. store and
display their best score over all the games..
any ideas how to go about this?
Oliver Wong - 29 Nov 2005 20:23 GMT
> PROBLEM:
> 'Modify the game to allowe the user to specify the difficulty of the
[quoted text clipped - 9 lines]
>
> any ideas how to go about this?
Whenever I roll two six sided dice and add them together, I get a number
between two and twelve (as opposed to one and twelve).
If my memory serves, you're that person who was trying to write a game
in which a single 12 sided die was being rolled, correct? Well, assuming you
got that game working, I would first try to generalize it so that you could
roll dice with any number of sides. Once that works, I'd generalize again so
that any number of dice could be rolled.
- Oliver
Hal Rosser - 29 Nov 2005 21:54 GMT
> PROBLEM:
> 'Modify the game to allowe the user to specify the difficulty of the
[quoted text clipped - 9 lines]
>
> any ideas how to go about this?
The command line parameters he speaks of is handled in the main easily.
That's what the (String [] args) arguments are all about.
args[0] would have a value of "6" in the example you gave, and args[1] would
be "6".
Keep in mind these are strings.
That should be enough without writing the code for you, which your professor
wouldn't want us to do.
Roedy Green - 30 Nov 2005 00:09 GMT
On 29 Nov 2005 11:58:51 -0800, "patrick_woflian"
<gingercrock@hotmail.com> wrote, quoted or indirectly quoted someone
who said :
>any ideas how to go about this?
see http://mindprod.com/jgloss/homework.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Alan Krueger - 30 Nov 2005 03:54 GMT
> PROBLEM:
> 'Modify the game to allowe the user to specify the difficulty of the
> game as command line parameters:
[...]
> any ideas how to go about this?
Since you didn't include any information on the program that needs to be
modified, nobody reading your post can tell how it differs from the
requirements and thus what needs to be changed.
It sounds like a homework assignment though, so you may want to ask your
teacher, instructor, professor, TA, etc.